Skip to content

Commit

Permalink
release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yatharthx committed Jan 24, 2017
1 parent aaf0d3c commit aba0de7
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 4 deletions.
87 changes: 85 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,88 @@
# react-emoj [![Build Status](https://travis-ci.org/yatharthk/react-emoj.svg?branch=master)](https://travis-ci.org/yatharthk/react-emoj)
# react-emoj [![Build Status](https://travis-ci.org/yatharthk/react-emoj.svg?branch=master)](https://travis-ci.org/yatharthk/react-emoj) [![Coverage Status](https://coveralls.io/repos/github/yatharthk/react-emoj/badge.svg?branch=master)](https://coveralls.io/github/yatharthk/react-emoj?branch=master)

Easy-use emoji component for React

> [WIP]
### Installation

```
npm install --save react-emoj
```

### Usage
`react-emoj` serves a minimal and convenient API for use.

#### Module exports
- `ReactEmoji` as React Component (default export)
- `Emoji` as an emoji utility that serves internally as a helper to `ReactEmoji` (exports.Emoji)

You can import them as:

`import ReactEmoji, { Emoji } from 'react-emoj'`

#### API
##### `ReactEmoji`
*ReactEmoji* shall be rendered with `props`:

###### emoji

Type: `Array(string)`

Example:
```js
<ReactEmoji emoji={['coffee', 'sunglasses']} />
```
Useful when all you need to render is a list of emoticons.

###### style

Type: `Object`

Example:
```js
<ReactEmoji
emoji={['coffee', 'sunglasses']}
style={{fontSize: '30px'}}
/>
```
Useful when you need to set color/font size of text or emoticons.

*ReactEmoji* can be used for displaying text that includes emoji by passing the text as child to the component. The text must always be of type `string`. The emoticons to be displayed shall be wrapped in colons in format `:emoji_code:`.

Example:
```js
<ReactEmoji style={{fontSize: '30px'}}>
I :hearts: coffee
</ReactEmoji>
```

##### `Emoji`

###### .emoji
Serves you a `JSON` object of emoji.

###### .emojify(text)

Type: `text: string`

Emoji Format: `:emoji_code:`

Example:
```js
Emoji.emojify('I love :coffee:') // I love ☕️
```
Useful when all you need is an `emojified` text, not a rendered component.

###### .fromArray(emojiList)

Type: `emojiList: [string] i.e an Array of string`

Emoji Format: `emoji_code`

Example:
```js
Emoji.fromArray(['coffee', 'sunglasses']) // ☕️😎
```
Useful when all you need is an emoji list, not a rendered component.

### License
MIT © Yatharth Khatri
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "react-emoj",
"version": "0.1.0-0",
"version": "0.1.0",
"description": "Easy-use emoji component for React",
"main": "./src/index.js",
"main": "./dist/react-emoj.min.js",
"scripts": {
"build": "webpack --config webpack.dist.config.js",
"clean": "rimraf ./dist",
Expand Down

0 comments on commit aba0de7

Please sign in to comment.