Emogeez React Components
This module provides react elements to display emojis in your web app. It exposes a popup to choose your emoji.
The popup can be populated with emojis with the emogeez-parser store,
or you can fetch manually the json file generated with emogeez-generator
hosted here(https://cdn.jsdelivr.net/gh/arthur-feral/emogeez@latest/packages/emogeez-generator/emojis/apple/apple.json).
You can test it by running the storybook.
clone the project
$ git clone https://github.com/arthur-feral/emogeez.git
$ cd emogeez/packages/emogeez-react-components
$ yarn && yarn run storybook
and go to http://localhost:9001 to explore the components.
How to use
Installation
$ yarn i emogeez-react-components
to be used in your application
you can use the package emogeez-parser
, go to the README for more informations. Shortly you may do something like this:
import parserFactory from 'emogeez-parser';
import React from 'react';
import ReactDOM from 'react-dom';
import emojisComponents from 'emogeez-react-components';
const {
EmojisPopupToggler,
} = emojisComponents;
const {
store,
} = parserFactory();
const addEmojiToTextArea = (emoji , event ) => {
};
fetchTheme('apple')
.then(() => {
const categories = Object.entries(store.getCategories('apple'));
ReactDOM.render(
<EmojisPopupToggler
categories={categories}
onClickEmoji={addEmojiToTextArea}
/>,
document.getElementById('myContainer')
);
});
Emoji
static propTypes = {
prefix: PropTypes.string,
emoji: PropTypes.object.isRequired,
onClick: PropTypes.func,
};
static defaultProps = {
prefix: 'emojis-',
onClick: noop,
};
static propTypes = {
prefix: PropTypes.string,
categories: PropTypes.array,
onClickEmoji: PropTypes.func,
isOpened: PropTypes.bool,
historyEnabled: PropTypes.bool,
historyLimit: PropTypes.number,
togglerRenderer: PropTypes.func,
onOpen: PropTypes.func,
onClose: PropTypes.func,
containerClassNameForPlacement: PropTypes.string,
destroyPopupIfNoToggler: PropTypes.bool,
};
static defaultProps = {
prefix: 'emojis',
categories: [],
onClickEmoji: noop,
isOpened: false,
historyEnabled: true,
historyLimit: 21,
togglerRenderer: (props, state) => (
<button>
<People className={CLASSNAMES.icon} />
</button>
),
onOpen: noop,
onClose: noop,
containerClassNameForPlacement: null,
destroyPopupIfNoToggler: false,
};
Notes
Please contribute if you found it useful! ❤️
return 'enjoy';