diff --git a/.storybook/src/Showcase.stories.tsx b/.storybook/src/Showcase.stories.tsx index 2643d9a..e090ee3 100644 --- a/.storybook/src/Showcase.stories.tsx +++ b/.storybook/src/Showcase.stories.tsx @@ -15,7 +15,7 @@ interface IconMeta { style: 'regular' | 'fill'; svgName: string; componentName: string; - keywords: string[]; + aliases: string[]; } const libContext = require.context('../../lib', false, /\.tsx$/); @@ -47,7 +47,7 @@ export const Showcase: Story = () => { return ( meta.name.includes(search) || - meta.keywords.some((keyword: string) => keyword.includes(search)) + meta.aliases.some((alias: string) => alias.includes(search)) ); }); } diff --git a/lib/FaceFun.tsx b/lib/FaceFun.tsx index ff2cf35..cb5d5eb 100644 --- a/lib/FaceFun.tsx +++ b/lib/FaceFun.tsx @@ -12,7 +12,7 @@ const FaceFun = (props: SVGProps) => ( diff --git a/lib/FaceNeutral.tsx b/lib/FaceNeutral.tsx index f5b2934..2db97dd 100644 --- a/lib/FaceNeutral.tsx +++ b/lib/FaceNeutral.tsx @@ -12,7 +12,7 @@ const FaceNeutral = (props: SVGProps) => ( diff --git a/lib/FaceSad.tsx b/lib/FaceSad.tsx index c2e9379..0eecf9f 100644 --- a/lib/FaceSad.tsx +++ b/lib/FaceSad.tsx @@ -12,7 +12,7 @@ const FaceSad = (props: SVGProps) => ( diff --git a/lib/FaceSmile.tsx b/lib/FaceSmile.tsx index 170233e..8e41e57 100644 --- a/lib/FaceSmile.tsx +++ b/lib/FaceSmile.tsx @@ -12,7 +12,7 @@ const FaceSmile = (props: SVGProps) => ( diff --git a/lib/FaceSurprise.tsx b/lib/FaceSurprise.tsx index a84d46f..6d63fe2 100644 --- a/lib/FaceSurprise.tsx +++ b/lib/FaceSurprise.tsx @@ -12,7 +12,7 @@ const FaceSurprise = (props: SVGProps) => ( diff --git a/lib/Fingerprint.tsx b/lib/Fingerprint.tsx deleted file mode 100644 index 7de9f66..0000000 --- a/lib/Fingerprint.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import * as React from 'react'; -import {SVGProps} from 'react'; -const Fingerprint = (props: SVGProps) => ( - - - -); -export default Fingerprint; diff --git a/lib/Strikethrough.tsx b/lib/Strikethrough.tsx index c8e73bf..51b6c44 100644 --- a/lib/Strikethrough.tsx +++ b/lib/Strikethrough.tsx @@ -12,7 +12,7 @@ const Strikethrough = (props: SVGProps) => ( diff --git a/lib/index.ts b/lib/index.ts index 311d2a6..6abf6f8 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -33,7 +33,6 @@ export {default as FaceSad} from './FaceSad'; export {default as FaceSmile} from './FaceSmile'; export {default as FaceSurprise} from './FaceSurprise'; export {default as File} from './File'; -export {default as Fingerprint} from './Fingerprint'; export {default as Folder} from './Folder'; export {default as FolderFill} from './FolderFill'; export {default as Gear} from './Gear'; diff --git a/metadata.json b/metadata.json index 0caf346..45177e3 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,10 @@ "style": "regular", "svgName": "archive", "componentName": "Archive", - "keywords": [ - "archive" + "aliases": [ + "tray", + "box", + "drawer" ] }, { @@ -14,48 +16,35 @@ "style": "regular", "svgName": "arrow-down", "componentName": "ArrowDown", - "keywords": [ - "arrow", - "down" - ] + "aliases": [] }, { "name": "arrow-left", "style": "regular", "svgName": "arrow-left", "componentName": "ArrowLeft", - "keywords": [ - "arrow", - "left" - ] + "aliases": [] }, { "name": "arrow-right", "style": "regular", "svgName": "arrow-right", "componentName": "ArrowRight", - "keywords": [ - "arrow", - "right" - ] + "aliases": [] }, { "name": "arrow-up", "style": "regular", "svgName": "arrow-up", "componentName": "ArrowUp", - "keywords": [ - "arrow", - "up" - ] + "aliases": [] }, { "name": "bell", "style": "regular", "svgName": "bell", "componentName": "Bell", - "keywords": [ - "bell", + "aliases": [ "notify", "notification" ] @@ -65,9 +54,9 @@ "style": "regular", "svgName": "bold", "componentName": "Bold", - "keywords": [ - "bold", - "text" + "aliases": [ + "text", + "style" ] }, { @@ -75,8 +64,7 @@ "style": "regular", "svgName": "bookmark", "componentName": "Bookmark", - "keywords": [ - "bookmark", + "aliases": [ "favourites" ] }, @@ -85,8 +73,7 @@ "style": "fill", "svgName": "bookmark-fill", "componentName": "BookmarkFill", - "keywords": [ - "bookmark", + "aliases": [ "favourites" ] }, @@ -95,27 +82,21 @@ "style": "regular", "svgName": "bucket", "componentName": "Bucket", - "keywords": [ - "bucket" - ] + "aliases": [] }, { "name": "bug", "style": "regular", "svgName": "bug", "componentName": "Bug", - "keywords": [ - "bug", - "ladybug" - ] + "aliases": [] }, { "name": "calendar", "style": "regular", "svgName": "calendar", "componentName": "Calendar", - "keywords": [ - "calendar", + "aliases": [ "date" ] }, @@ -124,8 +105,7 @@ "style": "regular", "svgName": "camera", "componentName": "Camera", - "keywords": [ - "camera", + "aliases": [ "photo" ] }, @@ -134,17 +114,15 @@ "style": "regular", "svgName": "case", "componentName": "Case", - "keywords": [ - "case" - ] + "aliases": [] }, { "name": "check", "style": "regular", "svgName": "check", "componentName": "Check", - "keywords": [ - "check" + "aliases": [ + "done" ] }, { @@ -152,9 +130,8 @@ "style": "regular", "svgName": "chevron-down", "componentName": "ChevronDown", - "keywords": [ - "chevron", - "down" + "aliases": [ + "arrow" ] }, { @@ -162,9 +139,8 @@ "style": "regular", "svgName": "chevron-left", "componentName": "ChevronLeft", - "keywords": [ - "chevron", - "left" + "aliases": [ + "arrow" ] }, { @@ -172,9 +148,8 @@ "style": "regular", "svgName": "chevron-right", "componentName": "ChevronRight", - "keywords": [ - "chevron", - "right" + "aliases": [ + "arrow" ] }, { @@ -182,9 +157,8 @@ "style": "regular", "svgName": "chevron-up", "componentName": "ChevronUp", - "keywords": [ - "chevron", - "up" + "aliases": [ + "arrow" ] }, { @@ -192,8 +166,7 @@ "style": "regular", "svgName": "clock", "componentName": "Clock", - "keywords": [ - "clock", + "aliases": [ "time" ] }, @@ -202,17 +175,14 @@ "style": "regular", "svgName": "cloud", "componentName": "Cloud", - "keywords": [ - "cloud" - ] + "aliases": [] }, { "name": "comment", "style": "regular", "svgName": "comment", "componentName": "Comment", - "keywords": [ - "comment", + "aliases": [ "message", "bubble" ] @@ -222,8 +192,7 @@ "style": "regular", "svgName": "compass", "componentName": "Compass", - "keywords": [ - "compass", + "aliases": [ "direction", "navigation" ] @@ -233,11 +202,8 @@ "style": "regular", "svgName": "cpu", "componentName": "Cpu", - "keywords": [ - "cpu", - "central", - "processing", - "unit" + "aliases": [ + "processor" ] }, { @@ -245,27 +211,22 @@ "style": "regular", "svgName": "credit-card", "componentName": "CreditCard", - "keywords": [ - "credit", - "card" - ] + "aliases": [] }, { "name": "database", "style": "regular", "svgName": "database", "componentName": "Database", - "keywords": [ - "database" - ] + "aliases": [] }, { "name": "display", "style": "regular", "svgName": "display", "componentName": "Display", - "keywords": [ - "display", + "aliases": [ + "monitor", "screen" ] }, @@ -274,8 +235,7 @@ "style": "regular", "svgName": "envelope", "componentName": "Envelope", - "keywords": [ - "envelope", + "aliases": [ "mail" ] }, @@ -284,18 +244,15 @@ "style": "regular", "svgName": "eye", "componentName": "Eye", - "keywords": [ - "eye" - ] + "aliases": [] }, { "name": "face-fun", "style": "regular", "svgName": "face-fun", "componentName": "FaceFun", - "keywords": [ - "face", - "fun" + "aliases": [ + "happy" ] }, { @@ -303,91 +260,61 @@ "style": "regular", "svgName": "face-neutral", "componentName": "FaceNeutral", - "keywords": [ - "face", - "neutral" - ] + "aliases": [] }, { "name": "face-sad", "style": "regular", "svgName": "face-sad", "componentName": "FaceSad", - "keywords": [ - "face", - "sad" - ] + "aliases": [] }, { "name": "face-smile", "style": "regular", "svgName": "face-smile", "componentName": "FaceSmile", - "keywords": [ - "face", - "smile" - ] + "aliases": [] }, { "name": "face-surprise", "style": "regular", "svgName": "face-surprise", "componentName": "FaceSurprise", - "keywords": [ - "face", - "surprise" - ] + "aliases": [] }, { "name": "file", "style": "regular", "svgName": "file", "componentName": "File", - "keywords": [ - "file", + "aliases": [ "document", "paper" ] }, - { - "name": "fingerprint", - "style": "regular", - "svgName": "fingerprint", - "componentName": "Fingerprint", - "keywords": [ - "finger", - "print", - "scan", - "touch" - ] - }, { "name": "folder", "style": "regular", "svgName": "folder", "componentName": "Folder", - "keywords": [ - "folder" - ] + "aliases": [] }, { "name": "folder", "style": "fill", "svgName": "folder-fill", "componentName": "FolderFill", - "keywords": [ - "folder" - ] + "aliases": [] }, { "name": "gear", "style": "regular", "svgName": "gear", "componentName": "Gear", - "keywords": [ - "gear", + "aliases": [ "setting", - "customization", + "custom", "tuning" ] }, @@ -396,8 +323,7 @@ "style": "regular", "svgName": "globe", "componentName": "Globe", - "keywords": [ - "globe", + "aliases": [ "language", "planet" ] @@ -407,11 +333,9 @@ "style": "regular", "svgName": "hand-point-up", "componentName": "HandPointUp", - "keywords": [ - "hand", - "point", - "finger", + "aliases": [ "touch", + "finger", "arm" ] }, @@ -420,18 +344,14 @@ "style": "regular", "svgName": "hard-drive", "componentName": "HardDrive", - "keywords": [ - "hard", - "drive" - ] + "aliases": [] }, { "name": "heart", "style": "regular", "svgName": "heart", "componentName": "Heart", - "keywords": [ - "heart", + "aliases": [ "like" ] }, @@ -440,8 +360,7 @@ "style": "fill", "svgName": "heart-fill", "componentName": "HeartFill", - "keywords": [ - "heart", + "aliases": [ "like" ] }, @@ -450,8 +369,7 @@ "style": "regular", "svgName": "home", "componentName": "Home", - "keywords": [ - "home", + "aliases": [ "house" ] }, @@ -460,9 +378,9 @@ "style": "regular", "svgName": "italic", "componentName": "Italic", - "keywords": [ - "italic", - "text" + "aliases": [ + "text", + "style" ] }, { @@ -470,8 +388,7 @@ "style": "regular", "svgName": "key", "componentName": "Key", - "keywords": [ - "key", + "aliases": [ "security" ] }, @@ -480,8 +397,7 @@ "style": "regular", "svgName": "link", "componentName": "Link", - "keywords": [ - "link", + "aliases": [ "chain" ] }, @@ -490,8 +406,7 @@ "style": "regular", "svgName": "lock", "componentName": "Lock", - "keywords": [ - "lock", + "aliases": [ "security" ] }, @@ -500,9 +415,7 @@ "style": "regular", "svgName": "lock-open", "componentName": "LockOpen", - "keywords": [ - "lock", - "open", + "aliases": [ "security" ] }, @@ -511,8 +424,7 @@ "style": "regular", "svgName": "magnifier", "componentName": "Magnifier", - "keywords": [ - "magnifier", + "aliases": [ "search" ] }, @@ -521,18 +433,14 @@ "style": "regular", "svgName": "microphone", "componentName": "Microphone", - "keywords": [ - "microphone", - "mic" - ] + "aliases": [] }, { "name": "minus", "style": "regular", "svgName": "minus", "componentName": "Minus", - "keywords": [ - "minus", + "aliases": [ "remove", "delete" ] @@ -542,9 +450,7 @@ "style": "regular", "svgName": "paperclip", "componentName": "Paperclip", - "keywords": [ - "paper", - "clip", + "aliases": [ "attach" ] }, @@ -553,10 +459,9 @@ "style": "regular", "svgName": "person", "componentName": "Person", - "keywords": [ - "person", + "aliases": [ "profile", - "man" + "human" ] }, { @@ -564,8 +469,7 @@ "style": "regular", "svgName": "picture", "componentName": "Picture", - "keywords": [ - "picture", + "aliases": [ "image", "photo" ] @@ -575,8 +479,9 @@ "style": "regular", "svgName": "pin", "componentName": "Pin", - "keywords": [ - "pin" + "aliases": [ + "attach", + "fix" ] }, { @@ -584,8 +489,9 @@ "style": "fill", "svgName": "pin-fill", "componentName": "PinFill", - "keywords": [ - "pin" + "aliases": [ + "attach", + "fix" ] }, { @@ -593,8 +499,7 @@ "style": "regular", "svgName": "plus", "componentName": "Plus", - "keywords": [ - "plus", + "aliases": [ "add", "new" ] @@ -604,26 +509,21 @@ "style": "regular", "svgName": "puzzle", "componentName": "Puzzle", - "keywords": [ - "puzzle" - ] + "aliases": [] }, { "name": "server", "style": "regular", "svgName": "server", "componentName": "Server", - "keywords": [ - "server" - ] + "aliases": [] }, { "name": "shield", "style": "regular", "svgName": "shield", "componentName": "Shield", - "keywords": [ - "shield", + "aliases": [ "security" ] }, @@ -632,9 +532,9 @@ "style": "regular", "svgName": "shopping-bag", "componentName": "ShoppingBag", - "keywords": [ - "shopping", - "bag" + "aliases": [ + "basket", + "food" ] }, { @@ -642,9 +542,9 @@ "style": "regular", "svgName": "shopping-basket", "componentName": "ShoppingBasket", - "keywords": [ - "shopping", - "basket" + "aliases": [ + "bag", + "food" ] }, { @@ -652,9 +552,9 @@ "style": "regular", "svgName": "shopping-cart", "componentName": "ShoppingCart", - "keywords": [ - "cart", - "shopping" + "aliases": [ + "basket", + "food" ] }, { @@ -662,8 +562,8 @@ "style": "regular", "svgName": "smartphone", "componentName": "Smartphone", - "keywords": [ - "smartphone" + "aliases": [ + "telephone" ] }, { @@ -671,8 +571,7 @@ "style": "regular", "svgName": "star", "componentName": "Star", - "keywords": [ - "star", + "aliases": [ "favourites" ] }, @@ -681,8 +580,7 @@ "style": "fill", "svgName": "star-fill", "componentName": "StarFill", - "keywords": [ - "star", + "aliases": [ "favourites" ] }, @@ -691,8 +589,7 @@ "style": "regular", "svgName": "sticker", "componentName": "Sticker", - "keywords": [ - "sticker", + "aliases": [ "paper" ] }, @@ -701,9 +598,9 @@ "style": "regular", "svgName": "strikethrough", "componentName": "Strikethrough", - "keywords": [ - "strikethrough", - "text" + "aliases": [ + "text", + "style" ] }, { @@ -711,27 +608,23 @@ "style": "regular", "svgName": "suitcase", "componentName": "Suitcase", - "keywords": [ - "suitcase" - ] + "aliases": [] }, { "name": "target", "style": "regular", "svgName": "target", "componentName": "Target", - "keywords": [ - "target" - ] + "aliases": [] }, { "name": "thumbs-down", "style": "regular", "svgName": "thumbs-down", "componentName": "ThumbsDown", - "keywords": [ - "thumb", + "aliases": [ "dislike", + "finger", "arm" ] }, @@ -740,9 +633,9 @@ "style": "fill", "svgName": "thumbs-down-fill", "componentName": "ThumbsDownFill", - "keywords": [ - "thumb", + "aliases": [ "dislike", + "finger", "arm" ] }, @@ -751,9 +644,9 @@ "style": "regular", "svgName": "thumbs-up", "componentName": "ThumbsUp", - "keywords": [ - "thumb", + "aliases": [ "like", + "finger", "arm" ] }, @@ -762,9 +655,9 @@ "style": "fill", "svgName": "thumbs-up-fill", "componentName": "ThumbsUpFill", - "keywords": [ - "thumb", + "aliases": [ "like", + "finger", "arm" ] }, @@ -773,9 +666,7 @@ "style": "regular", "svgName": "thunderbolt", "componentName": "Thunderbolt", - "keywords": [ - "thunderbolt", - "bolt", + "aliases": [ "flash", "lightning", "electricity" @@ -786,9 +677,7 @@ "style": "fill", "svgName": "thunderbolt-fill", "componentName": "ThunderboltFill", - "keywords": [ - "thunderbolt", - "bolt", + "aliases": [ "flash", "lightning", "electricity" @@ -799,8 +688,7 @@ "style": "regular", "svgName": "trash", "componentName": "Trash", - "keywords": [ - "trash", + "aliases": [ "delete", "remove" ] @@ -810,8 +698,10 @@ "style": "regular", "svgName": "tray", "componentName": "Tray", - "keywords": [ - "tray" + "aliases": [ + "archive", + "box", + "drawer" ] }, { @@ -819,9 +709,9 @@ "style": "regular", "svgName": "trolley", "componentName": "Trolley", - "keywords": [ - "trolley", - "cart" + "aliases": [ + "cart", + "box" ] }, { @@ -829,9 +719,9 @@ "style": "regular", "svgName": "underline", "componentName": "Underline", - "keywords": [ - "underline", - "text" + "aliases": [ + "text", + "style" ] }, { @@ -839,8 +729,7 @@ "style": "regular", "svgName": "video", "componentName": "Video", - "keywords": [ - "video", + "aliases": [ "camera" ] }, @@ -849,8 +738,7 @@ "style": "regular", "svgName": "xmark", "componentName": "Xmark", - "keywords": [ - "xmark", + "aliases": [ "close", "delete", "remove" diff --git a/scripts/download.js b/scripts/download.js index 3f1f676..33d2fca 100644 --- a/scripts/download.js +++ b/scripts/download.js @@ -9,6 +9,8 @@ const FIGMA_TOKEN = process.env.FIGMA_TOKEN; const FIGMA_FILE = process.env.FIGMA_FILE; const FIGMA_PAGE = process.env.FIGMA_PAGE; +const EMPTY_ALIASES_STRING = '-'; + function parsePropertiesString(str) { return str.split(/\s*,\s*/).reduce((acc, prop) => { const [name, value] = prop.split('='); @@ -42,24 +44,29 @@ function createSvgBuilder(metadata) { } for (const icon of iconSet.children) { - const {style, keywords = ''} = parsePropertiesString(icon.name); + const props = parsePropertiesString(icon.name); const svg = iconsById[icon.id].svg; let name = iconSet.name; + let aliases = []; - if (!style) { + if (!props.style) { throw new Error(`Icon has no style: ${iconSet.name}`); } - if (style !== 'regular') { - name += `-${style}`; + if (props.style !== 'regular') { + name += `-${props.style}`; + } + + if (props.aliases && props.aliases !== EMPTY_ALIASES_STRING) { + aliases = props.aliases.split(' '); } metadata.icons.push({ name: iconSet.name, - style, + style: props.style, svgName: name, componentName: getComponentName(name), - keywords: keywords.split(' '), + aliases, }); await fs.writeFile(path.join(SVGS_DIR, `${name}.svg`), svg); } diff --git a/svgs/face-fun.svg b/svgs/face-fun.svg index 7f2b908..36d5ff0 100644 --- a/svgs/face-fun.svg +++ b/svgs/face-fun.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/svgs/face-neutral.svg b/svgs/face-neutral.svg index 75f24a2..5d4a8c8 100644 --- a/svgs/face-neutral.svg +++ b/svgs/face-neutral.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/svgs/face-sad.svg b/svgs/face-sad.svg index 6fe4135..db7f6f3 100644 --- a/svgs/face-sad.svg +++ b/svgs/face-sad.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/svgs/face-smile.svg b/svgs/face-smile.svg index 707c8b2..9c9b463 100644 --- a/svgs/face-smile.svg +++ b/svgs/face-smile.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/svgs/face-surprise.svg b/svgs/face-surprise.svg index a4c525d..73110de 100644 --- a/svgs/face-surprise.svg +++ b/svgs/face-surprise.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/svgs/fingerprint.svg b/svgs/fingerprint.svg deleted file mode 100644 index fa8c934..0000000 --- a/svgs/fingerprint.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/svgs/strikethrough.svg b/svgs/strikethrough.svg index 7465609..0700e6c 100644 --- a/svgs/strikethrough.svg +++ b/svgs/strikethrough.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file