Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/react-stars.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class ReactStars extends Component {
count: props.count,
size: props.size,
char: props.char,
char2: props.char2,
// default color of inactive star
color1: props.color1,
// color of an active star
Expand Down Expand Up @@ -183,7 +184,7 @@ class ReactStars extends Component {

renderStars() {
const { halfStar, stars, uniqueness, config } = this.state
const { color1, color2, size, char, half, edit } = config
const { color1, color2, size, char, half, edit, char2 } = config
return stars.map((star, i) => {
let starClass = ''
if (half && !halfStar.hidden && halfStar.at === i) {
Expand All @@ -200,12 +201,12 @@ class ReactStars extends Component {
style={style}
key={i}
data-index={i}
data-forhalf={char}
data-forhalf={char2 || char}
onMouseOver={this.mouseOver.bind(this)}
onMouseMove={this.mouseOver.bind(this)}
onMouseLeave={this.mouseLeave.bind(this)}
onClick={this.clicked.bind(this)}>
{char}
{star.active ? char2 : char}
</span>
)
})
Expand Down Expand Up @@ -235,6 +236,7 @@ ReactStars.propTypes = {
value: PropTypes.number,
count: PropTypes.number,
char: PropTypes.string,
char2: PropTypes.string,
size: PropTypes.number,
color1: PropTypes.string,
color2: PropTypes.string
Expand All @@ -246,6 +248,7 @@ ReactStars.defaultProps = {
value: 0,
count: 5,
char: '★',
char2: '★',
size: 15,
color1: 'gray',
color2: '#ffd700',
Expand Down