Skip to content

Commit

Permalink
don't use the emoji folder to get images 😥
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacharyCrespin committed Aug 5, 2023
1 parent f4b33b9 commit 47a5487
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion emojiData.json

Large diffs are not rendered by default.

22 changes: 18 additions & 4 deletions index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,36 @@ async function generateEmojiData() {
);
const folder = `${emojiFolder}/${name}${hasSkinToneFolder ? '/' + skintone : ''}`;
const emojiStyles = await getFolders(path.join(__dirname, folder));
let images = {}
for (let index = 0; index < emojiStyles.length; index++) {
const style = emojiStyles[index];
const image = await getFiles(path.join(__dirname, folder, style));
images[style] = image
}

emojiData.push({
glyph: glyphMod,
unicode,
folder,
folder: folder.replace(emojiFolder, ""),
images,
emojiStyles
})
}
} else {
const folder = `${emojiFolder}/${name}`;
const emojiStyles = await getFolders(path.join(__dirname, folder));
let images = {}
for (let index = 0; index < emojiStyles.length; index++) {
const style = emojiStyles[index];
const image = await getFiles(path.join(__dirname, folder, style));
images[style] = image
}

emojiData.push({
glyph,
unicode,
folder,
folder: folder.replace(emojiFolder, ""),
images,
emojiStyles
})
}
Expand Down Expand Up @@ -122,9 +136,9 @@ async function getEmoji(key, q, style) {
return;
}
const folder = `${data.folder}/${style}`;
const image = await getFiles(path.join(__dirname, folder));
const image = data.images[style];
if (image.length == 1) {
return `${folder}/${image}`.replace(emojiFolder, "");
return `${folder}/${image}`;
} else {
console.log('Unexpected folder contents');
return;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fluentui-emoji-js",
"version": "1.1.0",
"version": "1.1.1",
"description": "A JavaScript wrapper for Microsoft's Fluent Emojis",
"main": "index.cjs",
"scripts": {
Expand Down

0 comments on commit 47a5487

Please sign in to comment.