Links: add dynamic icon count to download link
This commit is contained in:
@@ -2,6 +2,8 @@ import React from "react";
|
|||||||
import { OutboundLink } from "react-ga";
|
import { OutboundLink } from "react-ga";
|
||||||
import { ArrowElbowDownRight } from "phosphor-react";
|
import { ArrowElbowDownRight } from "phosphor-react";
|
||||||
|
|
||||||
|
import { iconCount } from "../../lib/icons";
|
||||||
|
|
||||||
import "./Links.css";
|
import "./Links.css";
|
||||||
|
|
||||||
interface LinksProps {}
|
interface LinksProps {}
|
||||||
@@ -18,7 +20,7 @@ const Links: React.FC<LinksProps> = () => {
|
|||||||
download
|
download
|
||||||
type="application/zip"
|
type="application/zip"
|
||||||
>
|
>
|
||||||
Download all
|
Download all ({iconCount})
|
||||||
</OutboundLink>
|
</OutboundLink>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -29,7 +31,7 @@ const Links: React.FC<LinksProps> = () => {
|
|||||||
eventLabel="Figma library"
|
eventLabel="Figma library"
|
||||||
style={{ textDecoration: "line-through" }}
|
style={{ textDecoration: "line-through" }}
|
||||||
>
|
>
|
||||||
Figma library
|
Add Figma library
|
||||||
</OutboundLink>
|
</OutboundLink>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -40,7 +42,7 @@ const Links: React.FC<LinksProps> = () => {
|
|||||||
eventLabel="Figma plugin"
|
eventLabel="Figma plugin"
|
||||||
style={{ textDecoration: "line-through" }}
|
style={{ textDecoration: "line-through" }}
|
||||||
>
|
>
|
||||||
Figma plugin
|
Add Figma plugin
|
||||||
</OutboundLink>
|
</OutboundLink>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -5562,3 +5562,5 @@ export const icons: ReadonlyArray<IconEntry> = [
|
|||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
console.log(`${icons.length} icons`);
|
console.log(`${icons.length} icons`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const iconCount = (icons.length * 6).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
Reference in New Issue
Block a user