From 759fa5f53a8a08e010ff7255245d065ed620b389 Mon Sep 17 00:00:00 2001 From: rektdeckard Date: Mon, 12 Oct 2020 00:37:11 -0400 Subject: [PATCH] Links: add dynamic icon count to download link --- src/components/Links/Links.tsx | 8 +++++--- src/lib/icons.ts | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Links/Links.tsx b/src/components/Links/Links.tsx index 378a1b4..9e53d54 100644 --- a/src/components/Links/Links.tsx +++ b/src/components/Links/Links.tsx @@ -2,6 +2,8 @@ import React from "react"; import { OutboundLink } from "react-ga"; import { ArrowElbowDownRight } from "phosphor-react"; +import { iconCount } from "../../lib/icons"; + import "./Links.css"; interface LinksProps {} @@ -18,7 +20,7 @@ const Links: React.FC = () => { download type="application/zip" > - Download all + Download all ({iconCount})
@@ -29,7 +31,7 @@ const Links: React.FC = () => { eventLabel="Figma library" style={{ textDecoration: "line-through" }} > - Figma library + Add Figma library
@@ -40,7 +42,7 @@ const Links: React.FC = () => { eventLabel="Figma plugin" style={{ textDecoration: "line-through" }} > - Figma plugin + Add Figma plugin
diff --git a/src/lib/icons.ts b/src/lib/icons.ts index a704cfb..30fea6c 100644 --- a/src/lib/icons.ts +++ b/src/lib/icons.ts @@ -5562,3 +5562,5 @@ export const icons: ReadonlyArray = [ if (process.env.NODE_ENV === "development") { console.log(`${icons.length} icons`); } + +export const iconCount = (icons.length * 6).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); \ No newline at end of file