MCPcopy
hub / github.com/Semantic-Org/Semantic-UI-React / render

Method render

src/modules/Rating/Rating.js:53–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51 }
52
53 render() {
54 const { className, disabled, icon, maxRating, size } = this.props
55 const { rating, selectedIndex, isSelecting } = this.state
56
57 const classes = cx(
58 'ui',
59 icon,
60 size,
61 useKeyOnly(disabled, 'disabled'),
62 useKeyOnly(isSelecting && !disabled && selectedIndex >= 0, 'selected'),
63 'rating',
64 className,
65 )
66 const rest = getUnhandledProps(Rating, this.props)
67 const ElementType = getElementType(Rating, this.props)
68
69 return (
70 <ElementType
71 {...rest}
72 className={classes}
73 role='radiogroup'
74 onMouseLeave={this.handleMouseLeave}
75 tabIndex={disabled ? 0 : -1}
76 >
77 {_.times(maxRating, (i) => (
78 <RatingIcon
79 tabIndex={disabled ? -1 : 0}
80 active={rating >= i + 1}
81 aria-checked={rating === i + 1}
82 aria-posinset={i + 1}
83 aria-setsize={maxRating}
84 index={i}
85 key={i}
86 onClick={this.handleIconClick}
87 onMouseEnter={this.handleIconMouseEnter}
88 selected={selectedIndex >= i && isSelecting}
89 />
90 ))}
91 </ElementType>
92 )
93 }
94}
95
96Rating.propTypes = {

Callers

nothing calls this directly

Calls 3

useKeyOnlyFunction · 0.90
getUnhandledPropsFunction · 0.90
getElementTypeFunction · 0.90

Tested by

no test coverage detected