mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 18:07:31 -07:00
refactor: ♻️ make skin tones modular
Could possibly be for future custom emoji sets that support custom skin tones? (i.e. Mutant Standard)
This commit is contained in:
parent
8f16d0b223
commit
12e032e6ac
3 changed files with 15 additions and 12 deletions
|
@ -10,11 +10,11 @@
|
||||||
"
|
"
|
||||||
></i>
|
></i>
|
||||||
<slot></slot> ({{ emojis.length }})
|
<slot></slot> ({{ emojis.length }})
|
||||||
<span v-if="props.skinToneSelector">
|
<span v-if="props.skinToneSelector && props.skinTones">
|
||||||
<button
|
<button
|
||||||
v-for="skinTone in skinTones"
|
v-for="skinTone in props.skinTones"
|
||||||
class="_button"
|
class="_button"
|
||||||
@click="applySkinTone(skinTones.indexOf(skinTone))"
|
@click="applySkinTone(props.skinTones.indexOf(skinTone) + 1)"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="ph-circle ph-fill ph-fw ph-lg"
|
class="ph-circle ph-fill ph-fw ph-lg"
|
||||||
|
@ -44,17 +44,9 @@ const props = defineProps<{
|
||||||
emojis: string[];
|
emojis: string[];
|
||||||
initialShown?: boolean;
|
initialShown?: boolean;
|
||||||
skinToneSelector?: boolean;
|
skinToneSelector?: boolean;
|
||||||
|
skinTones?: string[];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const skinTones = [
|
|
||||||
"#FFDC5E",
|
|
||||||
"#F7DFCF",
|
|
||||||
"#F3D3A3",
|
|
||||||
"#D6AE89",
|
|
||||||
"#B17F56",
|
|
||||||
"#7D523C",
|
|
||||||
];
|
|
||||||
|
|
||||||
const localEmojis = ref([...props.emojis]);
|
const localEmojis = ref([...props.emojis]);
|
||||||
|
|
||||||
function applySkinTone(custom?: number) {
|
function applySkinTone(custom?: number) {
|
||||||
|
|
|
@ -114,6 +114,7 @@
|
||||||
v-for="category in unicodeEmojiCategories"
|
v-for="category in unicodeEmojiCategories"
|
||||||
:key="category"
|
:key="category"
|
||||||
:skin-tone-selector="category === 'people'"
|
:skin-tone-selector="category === 'people'"
|
||||||
|
:skin-tones="unicodeEmojiSkinTones"
|
||||||
:emojis="
|
:emojis="
|
||||||
emojilist
|
emojilist
|
||||||
.filter((e) => e.category === category)
|
.filter((e) => e.category === category)
|
||||||
|
@ -167,6 +168,7 @@ import XSection from "@/components/MkEmojiPicker.section.vue";
|
||||||
import {
|
import {
|
||||||
emojilist,
|
emojilist,
|
||||||
unicodeEmojiCategories,
|
unicodeEmojiCategories,
|
||||||
|
unicodeEmojiSkinTones,
|
||||||
UnicodeEmojiDef,
|
UnicodeEmojiDef,
|
||||||
getNicelyLabeledCategory,
|
getNicelyLabeledCategory,
|
||||||
} from "@/scripts/emojilist";
|
} from "@/scripts/emojilist";
|
||||||
|
|
|
@ -35,6 +35,15 @@ export const categoryMapping = {
|
||||||
"Flags": "flags",
|
"Flags": "flags",
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export const unicodeEmojiSkinTones = [
|
||||||
|
"#FFDC5E",
|
||||||
|
"#F7DFCF",
|
||||||
|
"#F3D3A3",
|
||||||
|
"#D6AE89",
|
||||||
|
"#B17F56",
|
||||||
|
"#7D523C",
|
||||||
|
];
|
||||||
|
|
||||||
export function addSkinTone(emoji: string, skinTone?: number) {
|
export function addSkinTone(emoji: string, skinTone?: number) {
|
||||||
const chosenSkinTone = skinTone || defaultStore.state.reactionPickerSkinTone;
|
const chosenSkinTone = skinTone || defaultStore.state.reactionPickerSkinTone;
|
||||||
const skinToneModifiers = [
|
const skinToneModifiers = [
|
||||||
|
|
Loading…
Reference in a new issue