diff --git a/docs/.vitepress/lib/releasedIcons.ts b/docs/.vitepress/lib/releasedIcons.ts new file mode 100644 index 000000000..7326406f8 --- /dev/null +++ b/docs/.vitepress/lib/releasedIcons.ts @@ -0,0 +1,13 @@ +import * as iconDetails from '../data/iconDetails/index.ts'; + +/** + * Icons that are not released yet are hidden, except on preview environments + * where `VITE_SHOW_AWAITING_RELEASE` is set. + */ +export const isVisibleIcon = ({ awaitingRelease }: { awaitingRelease?: boolean }) => + !awaitingRelease || process.env.VITE_SHOW_AWAITING_RELEASE === 'true'; + +/** + * Number of icons shown on the site, matching the latest release. + */ +export const getReleasedIconCount = () => Object.values(iconDetails).filter(isVisibleIcon).length; diff --git a/docs/.vitepress/theme/components/home/HomeHeroIconsCard.data.ts b/docs/.vitepress/theme/components/home/HomeHeroIconsCard.data.ts index e8bd6d51a..69d78713a 100644 --- a/docs/.vitepress/theme/components/home/HomeHeroIconsCard.data.ts +++ b/docs/.vitepress/theme/components/home/HomeHeroIconsCard.data.ts @@ -1,4 +1,5 @@ import iconNodes from '../../../data/iconNodes/index.ts'; +import { getReleasedIconCount } from '../../../lib/releasedIcons.ts'; const pickIcons = [ 'bot', @@ -92,7 +93,7 @@ const loader = { return { icons: selectedIcons, - iconsCount: icons.length, + iconsCount: getReleasedIconCount(), }; }, }; diff --git a/docs/.vitepress/theme/components/sponsor/SponsorStats.data.ts b/docs/.vitepress/theme/components/sponsor/SponsorStats.data.ts index fc28fad50..3dab191db 100644 --- a/docs/.vitepress/theme/components/sponsor/SponsorStats.data.ts +++ b/docs/.vitepress/theme/components/sponsor/SponsorStats.data.ts @@ -1,5 +1,5 @@ -import iconNodes from '../../../data/iconNodes/index.ts'; import fetchPackages from '../../../lib/fetchPackages.ts'; +import { getReleasedIconCount } from '../../../lib/releasedIcons.ts'; const NPM_DOWNLOADS_API = 'https://api.npmjs.org/downloads/point/last-week'; @@ -71,7 +71,7 @@ const loader = { return { stars, weeklyDownloads, - iconsCount: Object.keys(iconNodes).length, + iconsCount: getReleasedIconCount(), }; }, }; diff --git a/docs/guide/index.md b/docs/guide/index.md index 3e9537d0b..0b9ccdd49 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -1,13 +1,13 @@ --- title: What is Lucide? -description: An introduction to Lucide, an open-source icon library that provides 1600+ vector (svg) files for displaying icons and symbols in digital and non-digital projects. +description: An introduction to Lucide, an open-source icon library that provides 2000+ vector (svg) files for displaying icons and symbols in digital and non-digital projects. nextPage: - installation --- # What is Lucide? -Lucide is an open-source icon library that provides 1600+ vector (svg) files for displaying icons and symbols in digital and non-digital projects. The library aims to make it easier for designers and developers to incorporate icons into their projects by providing several official [packages](/packages). +Lucide is an open-source icon library that provides 2000+ vector (svg) files for displaying icons and symbols in digital and non-digital projects. The library aims to make it easier for designers and developers to incorporate icons into their projects by providing several official [packages](/packages). ## Available Icons diff --git a/docs/icons/icons.data.ts b/docs/icons/icons.data.ts index 40ff30d10..64f6de990 100644 --- a/docs/icons/icons.data.ts +++ b/docs/icons/icons.data.ts @@ -1,4 +1,5 @@ import * as iconDetails from '../.vitepress/data/iconDetails/index.ts'; +import { isVisibleIcon } from '../.vitepress/lib/releasedIcons.ts'; export default { async load() { @@ -19,12 +20,8 @@ export default { awaitingRelease, fromFork, }), - // We hide icons that are not released yet, we make exceptions for preview environments ) - .filter( - ({ awaitingRelease }) => - !awaitingRelease || process.env.VITE_SHOW_AWAITING_RELEASE === 'true', - ), + .filter(isVisibleIcon), }; }, };