Skip to content

Commit ed1aa0a

Browse files
authored
[Major][V2] (#48)
* Updated UI * Removed customization props, moved to SASS variables * Improved filtering performance
1 parent bc78bee commit ed1aa0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1279
-881
lines changed

README.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
# React Emoji Picker
1+
# React Emoji Picker V2.0.0
22

33
[![Greenkeeper badge](https://badges.greenkeeper.io/ealush/emoji-picker.svg)](https://greenkeeper.io/) [![npm version](https://badge.fury.io/js/emoji-picker-react.svg)](https://badge.fury.io/js/emoji-picker-react) [![Build Status](https://travis-ci.org/ealush/emoji-picker-react.svg?branch=master)](https://travis-ci.org/ealush/emoji-picker-react)
44

55
[Live demo](https://ealush.github.io/emoji-picker/)
66

77
![alt tag](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/recording.gif)
88

9+
## V2 Changes
10+
* Updated UI
11+
* Removed customization props, moved to SASS variables
12+
* Improved filtering performance
13+
14+
915
```
1016
npm i emoji-picker-react --save
1117
```
1218

1319
An easy to use React Emoji Picker Module.
14-
For easy integration with your app, you should consider using the companion package: [React Text field components with emoji picker](https://www.npmjs.com/package/emoji-picker-textfield).
1520

16-
![alt tag](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/1.png)
21+
22+
![skin tones](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/1.png)
1723

1824

1925
## Usage:
@@ -32,22 +38,38 @@ class MyComponent extends Component {
3238

3339
```
3440

35-
## Customization
41+
## UI Customization
42+
You can use custom CSS to modify each part of the picker's visibility.
43+
**COMPATABILITY NOTE**
44+
The markup of the picker is guaranteed to stay unchanged through each major version (with the exception of bugfixes), meaning you can safely assume the markup stays the same until version 3 gets released.
3645

37-
## Modifying the picker's height and width
38-
By default the picker is 240px wide and ~315px tall (depending on the position of the categories panel). To change the width and height of the picker, simply:
46+
### Customizatio via SCSS variables
47+
If your project uses SCSS, you can more easily customize your picker's visibility using the predefined [SASS variables](https://github.com/ealush/emoji-picker-react/blob/master/src/base.scss) (click to see all variables).
48+
To customize the picker using these variables, you will need to import the picker in two parts - js and css.
3949

4050
```js
41-
<EmojiPicker width="315" height="280"/>
42-
<EmojiPicker height="280"/> // width will default to 240
43-
<EmojiPicker width="315"/> // height will default to 240
51+
// MyComponent.js
52+
import EmojiPicker from 'emoji-picker-react';
53+
import 'emoji-picker-react/dist/universal/style.scss'; // or any other way you consume scss files
54+
55+
class MyComponent {
56+
// ...
57+
}
4458
```
4559

46-
If you chose a width that cannot fit a whole emoji at the end of each row (when you only leave room for 6.5 emojis, for example), the line will end at the last fully visible emoji, possibly leaving some empty space on the right. To resolve that, just increase or decrease the width of the picker to reach a perfect fit.
60+
Then you will need to import the stylesheet file from your own stylesheet, and override the default variables with your own.
4761

48-
A word on height: The height you determine by the height property, is of the emoji-list only, the search and categories panel are added to the height you specify.
62+
```scss
63+
// style.scss
64+
$size_emoji: 10px;
65+
$width_picker: 300px;
66+
$height_picker: 350px;
67+
$bg_picker: #f1f1f1;
68+
@import './node_modules/emoji-picker-react/dist/universal/style.scss'; // relative path to your node modules
4969

50-
![alt tag](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/5.png)
70+
```
71+
72+
![categories](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/5.png)
5173

5274
## Using custom category titles
5375
If you want to modify the currently existing category names, simply pass a mapping object with the names you would like to replace, for example:
@@ -69,22 +91,14 @@ Here is the list of all category names, accepted by customCategoryNames:
6991

7092
## Disabling the diversity picker
7193

72-
![alt tag](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/4.png)
94+
![diverse emojis](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/4.png)
7395

7496
The per emoji diversity gets triggered on hover or long click by default. By passing the prop `disableDiversityPicker` to the picker, it will be disabled and not get triggered.
7597

7698
```js
7799
<EmojiPicker disableDiversityPicker/>
78100
```
79101

80-
## Moving the categories panel around
81-
82-
```js
83-
<EmojiPicker nav="top"/> // default. no need to pass nav="top"
84-
<EmojiPicker nav="left"/>
85-
<EmojiPicker nav="bottom"/>
86-
```
87-
88102
## Preloading all images
89103
By default, each emoji category is loaded when first viewing it to reduce initial load time and improve perceived performance. This can sometimes take a while. In some cases you would want to load all images at once, for example, when lazy loading the picker in the background regardless of user interaction.
90104

@@ -140,7 +154,7 @@ and then, in your onEmojiClick callback:
140154
jsemoji.replace_colons(`:${emojiName}:`);
141155
```
142156

143-
![alt tag](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/2.png)
157+
![filtering](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/2.png)
144158

145159
# Image hosting
146160
## CDN
@@ -164,14 +178,14 @@ The picker will internally construct the image urls to appear like this:
164178
`http://example.com/emojis/64/1f448-1f3fd.png`
165179
(`1f448-1f3fd.png` is an emoji filename + extension)
166180

167-
![alt tag](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/3.png)
181+
![img](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/3.png)
168182

169183
# Cool stuff
170184

171185
## Per Emoji diversity picker
172186
Long clicking on diversity (skin-tone) enabled Emojies (mostly the hand Emojis), will open a list of all skin tones for this Emoji.
173187

174-
![alt tag](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/4.png)
188+
![img](https://raw.githubusercontent.com/ealush/emoji-picker/master/screenshots/4.png)
175189

176190
# Attributions
177191
You can use this **picker**, free of charge, no attribution is needed. The emojis have their own license.

dist/index.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/universal/index.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/universal/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)