Force picker width in px
parent
c3f1c6c661
commit
895a31fecd
|
@ -37,17 +37,11 @@ export default class Category extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
var { name, emojis, perLine, hasStickyPosition, emojiProps } = this.props,
|
||||
var { name, emojis, hasStickyPosition, emojiProps } = this.props,
|
||||
emojis = emojis.slice(0),
|
||||
lines = [],
|
||||
linesCount = Math.ceil(emojis.length / perLine),
|
||||
labelStyles = {},
|
||||
labelSpanStyles = {}
|
||||
|
||||
Array(linesCount).fill().forEach((_, i) =>
|
||||
lines.push(emojis.splice(0, perLine))
|
||||
)
|
||||
|
||||
if (!hasStickyPosition) {
|
||||
labelStyles = {
|
||||
height: 28,
|
||||
|
@ -63,16 +57,12 @@ export default class Category extends React.Component {
|
|||
<span style={labelSpanStyles} ref='label'>{name}</span>
|
||||
</div>
|
||||
|
||||
{lines.map((emojis, i) =>
|
||||
<div key={`line-${i}`}>
|
||||
{emojis.map((emoji) =>
|
||||
<Emoji
|
||||
key={emoji}
|
||||
emoji={emoji}
|
||||
{...emojiProps}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{emojis.map((emoji) =>
|
||||
<Emoji
|
||||
key={emoji}
|
||||
emoji={emoji}
|
||||
{...emojiProps}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
|
@ -82,7 +72,6 @@ Category.propTypes = {
|
|||
emojis: React.PropTypes.array,
|
||||
hasStickyPosition: React.PropTypes.bool,
|
||||
name: React.PropTypes.string.isRequired,
|
||||
perLine: React.PropTypes.number.isRequired,
|
||||
emojiProps: React.PropTypes.object.isRequired,
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,10 @@ export default class Picker extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
var { perLine, emojiSize, sheetURL } = this.props
|
||||
var { perLine, emojiSize, sheetURL } = this.props,
|
||||
width = (perLine * (emojiSize + 12)) + 12 + 2
|
||||
|
||||
return <div className='emoji-picker'>
|
||||
return <div style={{width: width}} className='emoji-picker'>
|
||||
<div className='emoji-picker-bar'>
|
||||
Categories
|
||||
</div>
|
||||
|
@ -78,7 +79,6 @@ export default class Picker extends React.Component {
|
|||
key={category.name}
|
||||
name={category.name}
|
||||
emojis={category.emojis}
|
||||
perLine={perLine}
|
||||
hasStickyPosition={this.hasStickyPosition}
|
||||
emojiProps={{
|
||||
size: emojiSize,
|
||||
|
|
Loading…
Reference in New Issue