-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into issue-#652
- Loading branch information
Showing
24 changed files
with
17,277 additions
and
11,202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
dist | ||
*.polyfill.js | ||
emoji.js | ||
node_modules | ||
docs/config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ dist | |
debug | ||
/components | ||
.nyc_output | ||
emojione.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,87 @@ | ||
import React from 'react'; | ||
import React, { Component } from 'react'; | ||
import ReactMarkdown from 'react-markdown'; | ||
import _ from 'underscore'; | ||
import emojione from 'emojione'; | ||
import EmojiMenu from '../../../dist/emoji-menu'; | ||
import Button from '../../../dist/button'; | ||
import Props from './props'; | ||
import components from '../../components.json'; | ||
import Paper from '../../../dist/paper'; | ||
|
||
const usage = '```js\n import EmojiMenu from \'anchor-ui/emoji-menu\';'; | ||
|
||
const EmojiMenuDoc = () => { | ||
const componentData = _.find(components, component => component.displayName === 'EmojiMenu'); | ||
const style = { | ||
paper: { | ||
display: 'flex', | ||
flexWrap: 'wrap', | ||
alignItems: 'center', | ||
margin: 0, | ||
padding: '20px' | ||
}, | ||
emojiMenu: { margin: '10px' } | ||
}; | ||
|
||
return ( | ||
<article className="doc"> | ||
<h1>EmojiMenu</h1> | ||
<section> | ||
<h1>Description</h1> | ||
<p>{componentData.description}</p> | ||
</section> | ||
<section> | ||
<h1>Usage</h1> | ||
<ReactMarkdown source={usage} className="markdown" /> | ||
</section> | ||
<section> | ||
<h1>Examples</h1> | ||
<Paper style={style.paper}> | ||
<EmojiMenu | ||
sendEmoji={() => {}} | ||
style={style.emojiMenu} | ||
/> | ||
</Paper> | ||
</section> | ||
<Props props={componentData.props} /> | ||
</article> | ||
); | ||
}; | ||
class EmojiMenuDoc extends Component { | ||
static createMarkup = text => ({ | ||
__html: emojione.toImage(text) | ||
}) | ||
|
||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
open: false, | ||
emoji: '' | ||
}; | ||
} | ||
|
||
toggleMenu = () => this.setState({ open: !this.state.open }) | ||
|
||
sendEmoji = ({ shortname }) => this.setState({ emoji: shortname }) | ||
|
||
render() { | ||
const componentData = _.find(components, component => component.displayName === 'EmojiMenu'); | ||
const style = { | ||
paper: { | ||
display: 'flex', | ||
flexWrap: 'wrap', | ||
alignItems: 'center', | ||
margin: 0, | ||
padding: '20px' | ||
}, | ||
emojiMenu: { margin: '10px' } | ||
}; | ||
|
||
return ( | ||
<article className="doc"> | ||
<h1>EmojiMenu</h1> | ||
<section> | ||
<h1>Description</h1> | ||
<p>{componentData.description}</p> | ||
</section> | ||
<a | ||
href="https://www.emojione.com/" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
This component uses free Emoji icons supplied by EmojiOne | ||
</a> | ||
<section> | ||
<h1>Usage</h1> | ||
<ReactMarkdown source={usage} className="markdown" /> | ||
</section> | ||
<section> | ||
<h1>Examples</h1> | ||
<Paper style={style.paper}> | ||
{ | ||
this.state.emoji | ||
? <span style={style.emojiMenu} className="emojione" dangerouslySetInnerHTML={EmojiMenuDoc.createMarkup(this.state.emoji)} /> | ||
: null | ||
} | ||
<EmojiMenu | ||
sendEmoji={this.sendEmoji} | ||
style={style.emojiMenu} | ||
open={this.state.open} | ||
hideMenu={this.toggleMenu} | ||
/> | ||
<Button style={style.emojiMenu} onClick={this.toggleMenu}> | ||
Toggle EmojiMenu | ||
</Button> | ||
</Paper> | ||
</section> | ||
<Props props={componentData.props} /> | ||
</article> | ||
); | ||
} | ||
} | ||
|
||
export default EmojiMenuDoc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
rm ./emojione.json | ||
ls ./src/emoji-menu/emoji.js | ||
curl https://raw.githubusercontent.com/emojione/emojione/master/emoji.json > emojione.json | ||
node parse-emoji.js > src/emoji-menu/emoji.js | ||
node_modules/.bin/prettier src/emoji-menu/emoji.js --write --single-quote | ||
echo Downloaded and parsed emojione.json! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const emojione = require('./emojione.json'); | ||
const map = require('lodash/map'); | ||
|
||
console.log('export default ['); // eslint-disable-line no-console | ||
|
||
map(emojione, (e) => { | ||
console.log( // eslint-disable-line no-console | ||
`{ | ||
title: '${e.shortname.replace(/:levitate:/g, ':man_in_business_suit_levitating:')}${e.diversities.length > 0 && !e.diversity ? ' tone0' : ''}', | ||
name: '${e.name}', | ||
shortname: '${e.shortname.replace(/:levitate:/g, ':man_in_business_suit_levitating:')}', | ||
category: '${e.category}', | ||
diversity: ${Boolean(e.diversities.length > 0 || e.diversity)} | ||
},` | ||
); | ||
}); | ||
|
||
console.log('];'); // eslint-disable-line no-console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.