-
Notifications
You must be signed in to change notification settings - Fork 367
Expand file tree
/
Copy pathEmojiPicker.js
More file actions
58 lines (54 loc) · 1.29 KB
/
EmojiPicker.js
File metadata and controls
58 lines (54 loc) · 1.29 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React from 'react';
import EmojiPicker from 'emoji-picker-react';
import { css } from '@emotion/react';
import PropTypes from 'prop-types';
import { Box, Popup, useTheme } from '@embeddedchat/ui-elements';
import getEmojiPickerStyles from './EmojiPicker.styles';
const CustomEmojiPicker = ({
handleEmojiClick,
positionStyles = css`
position: absolute;
top: 0;
right: 0;
`,
wrapperId = 'emoji-popup',
onClose = () => {},
}) => {
const theme = useTheme();
const styles = getEmojiPickerStyles(theme);
const previewConfig = {
defaultEmoji: '1f60d',
defaultCaption: 'None',
showPreview: true,
};
return (
<Popup
positionStyles={positionStyles}
wrapperId={wrapperId}
onClose={onClose}
height="auto"
width="auto"
>
<Box
css={styles.emojiPicker}
role="dialog"
aria-modal="true"
aria-label="Emoji picker"
>
<EmojiPicker
height={400}
width={350}
onEmojiClick={handleEmojiClick}
previewConfig={previewConfig}
searchDisabled={false}
emojiStyle="facebook"
lazyLoadEmojis
/>
</Box>
</Popup>
);
};
export default CustomEmojiPicker;
CustomEmojiPicker.propTypes = {
handleEmojiClick: PropTypes.func,
};