-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
9,432 additions
and
31 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
50 changes: 50 additions & 0 deletions
50
poker/app/assets/javascripts/components/chat/emoji-box.js.jsx
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,50 @@ | ||
class EmojiBox extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { kamojis: this.getKamojis() }; | ||
} | ||
|
||
componentDidMount() { | ||
} | ||
|
||
handleKamoji(e){ | ||
this.props.onClickEmoji(e.target.innerHTML + ' ') | ||
} | ||
|
||
render() { | ||
let ks = this.state.kamojis.map((kamoji, index) => { | ||
return this.renderKamoji(index, kamoji); | ||
}); | ||
return ( | ||
<div className="dropdown-menu emoji-box" aria-labelledby="dropdownMenuButton"> | ||
<ul> | ||
{ks} | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
renderKamoji(index,k){ | ||
return( | ||
<li key={index}> | ||
<a className="emoji-item" title={k} onClick={(e) => this.handleKamoji(e)}>{k}</a> | ||
</li> | ||
); | ||
} | ||
|
||
getKamojis () { | ||
return this.getRandomArrayElements(kamojiList, 40); | ||
} | ||
|
||
getRandomArrayElements(arr, count) { | ||
var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index; | ||
while (i-- > min) { | ||
index = Math.floor((i + 1) * Math.random()); | ||
temp = shuffled[index]; | ||
shuffled[index] = shuffled[i]; | ||
shuffled[i] = temp; | ||
} | ||
return shuffled.slice(min); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.