bigbuffet-rw/app/soapbox/components/emoji_selector.js

37 lines
910 B
JavaScript
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
2020-05-28 15:52:07 -07:00
import { ALLOWED_EMOJI } from 'soapbox/utils/emoji_reacts';
import emojify from 'soapbox/features/emoji/emoji';
import classNames from 'classnames';
export default class EmojiSelector extends React.Component {
2020-05-21 22:08:55 -07:00
static propTypes = {
onReact: PropTypes.func.isRequired,
visible: PropTypes.bool,
}
2020-05-21 22:08:55 -07:00
static defaultProps = {
onReact: () => {},
visible: false,
2020-05-21 22:08:55 -07:00
}
render() {
const { onReact, visible } = this.props;
return (
<div className={classNames('emoji-react-selector', { 'emoji-react-selector--visible': visible })}>
2020-05-21 22:08:55 -07:00
{ALLOWED_EMOJI.map((emoji, i) => (
<button
2020-05-21 22:08:55 -07:00
key={i}
className='emoji-react-selector__emoji'
dangerouslySetInnerHTML={{ __html: emojify(emoji) }}
onClick={onReact(emoji)}
/>
))}
</div>
);
}
}