Add recently used section and scroll to category

Signed-off-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
Tulir Asokan
2019-10-14 19:41:10 +03:00
parent 497b779334
commit 088c9bff9e
7 changed files with 115 additions and 34 deletions
+3 -4
View File
@@ -34,8 +34,7 @@ class Header extends React.Component {
this.handleClick = this.handleClick.bind(this);
}
handleClick(ev) {
const selected = ev.target.getAttribute("data-category-id");
handleClick(selected) {
this.setState({selected});
this.props.onAnchorClick(selected);
};
@@ -44,9 +43,9 @@ class Header extends React.Component {
return (
<nav className="mx_EmojiPicker_header">
{this.props.categories.map(category => (
<button key={category.id} className={`mx_EmojiPicker_anchor ${
<button disabled={!category.enabled} key={category.id} className={`mx_EmojiPicker_anchor ${
this.state.selected === category.id ? 'mx_EmojiPicker_anchor_selected' : ''}`}
onClick={this.handleClick} data-category-id={category.id} title={category.name}>
onClick={() => this.handleClick(category.id)} title={category.name}>
{icons.categories[category.id]()}
</button>
))}