-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate EmojiViewModel to React (#ACC-251) (#13493)
* refactor: migrate EmojiViewModel to React (#ACC-251) * Remove any type * Update tests * CR Fixes * Build fixes
- Loading branch information
Showing
10 changed files
with
613 additions
and
503 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
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,47 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2022 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
import cx from 'classnames'; | ||
import {FC} from 'react'; | ||
|
||
import {EmojiListItem} from './useEmoji'; | ||
|
||
interface EmojiItemProps { | ||
emoji: EmojiListItem; | ||
onClick: () => void; | ||
onMouseEnter: () => void; | ||
selectedEmoji?: boolean; | ||
} | ||
|
||
const EmojiItem: FC<EmojiItemProps> = ({emoji, onClick, onMouseEnter, selectedEmoji = false}) => ( | ||
<button | ||
type="button" | ||
className={cx('button-reset-default emoji', {selected: selectedEmoji})} | ||
css={{alignItems: 'flex-start', display: 'flex', flexDirection: 'column', width: '100%'}} | ||
onMouseEnter={onMouseEnter} | ||
onClick={onClick} | ||
aria-label={emoji.name} | ||
tabIndex={0} | ||
> | ||
<span className="symbol">{emoji.icon}</span> | ||
<span className="name">{emoji.name}</span> | ||
</button> | ||
); | ||
|
||
export default EmojiItem; |
File renamed without changes.
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,76 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2022 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
|
||
const inlineReplacements = [ | ||
{name: 'slight smile', shortcut: ':)'}, | ||
{name: 'slight smile', shortcut: ':-)'}, | ||
{name: 'smile', shortcut: ':D'}, | ||
{name: 'smile', shortcut: ':-D'}, | ||
{name: 'grinning', shortcut: ':-d'}, | ||
{name: 'sunglasses', shortcut: 'B-)'}, | ||
{name: 'sunglasses', shortcut: 'b-)'}, | ||
{name: 'sunglasses', shortcut: '8-)'}, | ||
{name: 'disappointed', shortcut: ':('}, | ||
{name: 'disappointed', shortcut: ':-('}, | ||
{name: 'wink', shortcut: ';)'}, | ||
{name: 'wink', shortcut: ';-)'}, | ||
{name: 'wink', shortcut: ';-]'}, | ||
{name: 'wink', shortcut: ';]'}, | ||
{name: 'confused', shortcut: ':/'}, | ||
{name: 'confused', shortcut: ':-/'}, | ||
{name: 'stuck out tongue', shortcut: ':P'}, | ||
{name: 'stuck out tongue', shortcut: ':-P'}, | ||
{name: 'stuck out tongue', shortcut: ':-p'}, | ||
{name: 'stuck out tongue winking eye', shortcut: ';P'}, | ||
{name: 'stuck out tongue winking eye', shortcut: ';-P'}, | ||
{name: 'stuck out tongue winking eye', shortcut: ';-p'}, | ||
{name: 'open mouth', shortcut: ':O'}, | ||
{name: 'open mouth', shortcut: ':-o'}, | ||
{name: 'innocent', shortcut: 'O:)'}, | ||
{name: 'innocent', shortcut: 'O:-)'}, | ||
{name: 'innocent', shortcut: 'o:)'}, | ||
{name: 'innocent', shortcut: 'o:-)'}, | ||
{name: 'smirk', shortcut: ';^)'}, | ||
{name: 'angry', shortcut: ':@'}, | ||
{name: 'rage', shortcut: '>:('}, | ||
{name: 'smiling imp', shortcut: '}:-)'}, | ||
{name: 'smiling imp', shortcut: '}:)'}, | ||
{name: 'smiling imp', shortcut: '3:-)'}, | ||
{name: 'smiling imp', shortcut: '3:)'}, | ||
{name: 'cry', shortcut: ":'-("}, | ||
{name: 'cry', shortcut: ":'("}, | ||
{name: 'cry', shortcut: ';('}, | ||
{name: 'joy', shortcut: ":'-)"}, | ||
{name: 'joy', shortcut: ":')"}, | ||
{name: 'kissing heart', shortcut: ':*'}, | ||
{name: 'kissing heart', shortcut: ':^*'}, | ||
{name: 'kissing heart', shortcut: ':-*'}, | ||
{name: 'neutral face', shortcut: ':-|'}, | ||
{name: 'neutral face', shortcut: ':|'}, | ||
{name: 'flushed', shortcut: ':$'}, | ||
{name: 'no mouth', shortcut: ':-X'}, | ||
{name: 'no mouth', shortcut: ':X'}, | ||
{name: 'no mouth', shortcut: ':-#'}, | ||
{name: 'no mouth', shortcut: ':#'}, | ||
{name: 'raised hands', shortcut: '\\o/'}, | ||
{name: 'heart', shortcut: '<3'}, | ||
{name: 'broken heart', shortcut: '</3'}, | ||
]; | ||
|
||
export default inlineReplacements; |
Oops, something went wrong.