Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 9112fea Author: saltrafael <oversaid_logodaedaly@slmail.me> Date: Mon Oct 25 15:03:59 2021 -0300 Add Emote Selector and Emote Comment creation ability commit cb8e790 Author: saltrafael <oversaid_logodaedaly@slmail.me> Date: Mon Oct 25 12:54:54 2021 -0300 Add new emote menu commit ba894b1 Author: saltrafael <oversaid_logodaedaly@slmail.me> Date: Mon Oct 25 12:26:11 2021 -0300 Refactor form-field
- Loading branch information
saltrafael
committed
Oct 25, 2021
1 parent
7765bb3
commit d45bc32
Showing
13 changed files
with
509 additions
and
248 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// @flow | ||
import React from 'react'; | ||
import emoji from 'emoji-dictionary'; | ||
import Button from 'component/button'; | ||
import OptimizedImage from 'component/optimizedImage'; | ||
import * as EMOTES from 'constants/emotes'; | ||
|
||
const OLD_QUICK_EMOJIS = [ | ||
emoji.getUnicode('rocket'), | ||
emoji.getUnicode('jeans'), | ||
emoji.getUnicode('fire'), | ||
emoji.getUnicode('heart'), | ||
emoji.getUnicode('open_mouth'), | ||
]; | ||
|
||
type Props = { commentValue: string, setCommentValue: (string) => void }; | ||
|
||
export default function EmoteSelector(props: Props) { | ||
const { commentValue, setCommentValue } = props; | ||
|
||
function addEmoteToComment(emote: string) { | ||
setCommentValue( | ||
commentValue + (commentValue && commentValue.charAt(commentValue.length - 1) !== ' ' ? ` ${emote} ` : `${emote} `) | ||
); | ||
} | ||
|
||
return ( | ||
<div className="emote__selector"> | ||
<div className="emotes-list"> | ||
<div className="emotes-list--row"> | ||
<div className="emotes-list--row-title">{__('Old')}</div> | ||
<div className="emotes-list--row-items"> | ||
{OLD_QUICK_EMOJIS.map((emoji) => ( | ||
<Button | ||
key={emoji} | ||
label={emoji} | ||
button="alt" | ||
className="button--file-action" | ||
onClick={() => addEmoteToComment(emoji)} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
|
||
<div className="emotes-list--row"> | ||
<div className="emotes-list--row-title">{__('Global')}</div> | ||
<div className="emotes-list--row-items"> | ||
{Object.keys(EMOTES).map((emote) => ( | ||
<Button | ||
key={String(emote)} | ||
title={`:${emote.toLowerCase()}:`} | ||
button="alt" | ||
className="button--file-action" | ||
onClick={() => addEmoteToComment(`:${emote.toLowerCase()}:`)} | ||
> | ||
<OptimizedImage src={String(EMOTES[emote])} /> | ||
</Button> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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.