Render emoji like a sticker

This commit is contained in:
Josh Perez 2021-10-06 13:37:53 -04:00 committed by GitHub
parent 1466f9f1b2
commit 7c9b8e919c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 97 additions and 30 deletions

View file

@ -26,7 +26,13 @@ import * as log from '../../logging/log';
export const skinTones = ['1F3FB', '1F3FC', '1F3FD', '1F3FE', '1F3FF'];
export type SkinToneKey = '1F3FB' | '1F3FC' | '1F3FD' | '1F3FE' | '1F3FF';
export type SizeClassType = '' | 'small' | 'medium' | 'large' | 'jumbo';
export type SizeClassType =
| ''
| 'small'
| 'medium'
| 'large'
| 'extra-large'
| 'max';
export type EmojiSkinVariation = {
unified: string;
@ -315,19 +321,22 @@ export function getSizeClass(str: string): SizeClassType {
const emojiCount = getEmojiCount(str);
if (emojiCount > 8) {
return '';
if (emojiCount === 1) {
return 'max';
}
if (emojiCount > 6) {
return 'small';
if (emojiCount === 2) {
return 'extra-large';
}
if (emojiCount > 4) {
return 'medium';
}
if (emojiCount > 2) {
if (emojiCount === 3) {
return 'large';
}
return 'jumbo';
if (emojiCount === 4) {
return 'medium';
}
if (emojiCount === 5) {
return 'small';
}
return '';
}
data.forEach(emoji => {