blob: 66146106bbceb439582bf3b54d1cfda2bb5f11b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import PropTypes from 'prop-types';
import React from 'react';
export default class EmojiPickerCategory extends React.Component {
static propTypes = {
category: PropTypes.string.isRequired,
icon: PropTypes.node.isRequired,
onCategoryClick: PropTypes.func.isRequired,
selected: PropTypes.bool.isRequired
}
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick(e) {
e.preventDefault();
this.props.onCategoryClick(this.props.category);
}
render() {
let className = 'emoji-picker__category';
if (this.props.selected) {
className += ' emoji-picker__category--selected';
}
return (
<a
className={className}
href='#'
onClick={this.handleClick}
>
{this.props.icon}
</a>
);
}
}
|