-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Dynamic emoji size #3561
feat: Dynamic emoji size #3561
Changes from 1 commit
8baee4f
7fa65be
1f1956c
379b771
156fe87
734ee3e
bcc0882
0b34771
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ const propTypes = { | |
/** Function to add the selected emoji to the main compose text input */ | ||
onEmojiSelected: PropTypes.func.isRequired, | ||
|
||
/** Props related to the dimensions of the window */ | ||
...windowDimensionsPropTypes, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NAB: I see there are many places in our code where this is prop is not documented but as per our style guide it would be nice if you include a JS comment doc for this for consistency. |
||
}; | ||
|
||
|
@@ -41,16 +42,17 @@ class EmojiPickerMenu extends Component { | |
} | ||
|
||
componentDidUpdate(prevProps) { | ||
if ( | ||
this.props.windowWidth !== prevProps.windowWidth | ||
) { | ||
// eslint-disable-next-line react/no-did-update-set-state | ||
this.setState({ | ||
emojiSize: dynamicEmojiSize(this.props.windowWidth), | ||
}); | ||
} | ||
if (this.props.windowWidth !== prevProps.windowWidth) { this.setDynamicEmojiSize(); } | ||
} | ||
|
||
/** | ||
* Sets emoji size dynamically based on the window width | ||
*/ | ||
setDynamicEmojiSize() { | ||
this.setState({ | ||
emojiSize: dynamicEmojiSize(this.props.windowWidth), | ||
}); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove unnecessary line break |
||
/** | ||
* Given an emoji item object, render a component based on its type. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ const propTypes = { | |
/** Whether this menu item is currently highlighted or not */ | ||
isHighlighted: PropTypes.bool.isRequired, | ||
|
||
/** Size of the emoji item */ | ||
size: PropTypes.number.isRequired, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing JS doc. |
||
}; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sorry for the confusion, i didn't mean the whole line, just the if condition, i.e.,
That would match our examples in the style guide. Could you make the same changes to the if conditions in your file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done