From ea1677e8ba16ef5f014107879d9f814883c44984 Mon Sep 17 00:00:00 2001 From: Cole Bemis Date: Fri, 15 Sep 2023 10:52:38 -0600 Subject: [PATCH] Clean up --- docs/src/components/app.tsx | 158 +++++++------------------------ docs/src/components/icon.tsx | 42 ++++++++ docs/src/lib/icons.ts | 12 +++ docs/src/lib/use-search-param.ts | 33 +++++++ 4 files changed, 121 insertions(+), 124 deletions(-) create mode 100644 docs/src/components/icon.tsx create mode 100644 docs/src/lib/icons.ts create mode 100644 docs/src/lib/use-search-param.ts diff --git a/docs/src/components/app.tsx b/docs/src/components/app.tsx index ade99821..e63a1760 100644 --- a/docs/src/components/app.tsx +++ b/docs/src/components/app.tsx @@ -1,21 +1,9 @@ import React from 'react'; -import iconsJson from '../../../dist/icons.json'; -import tagsJson from '../../../src/tags.json'; import clsx from 'clsx'; import { version } from '../../../package.json'; - -type StrokeLincap = 'round' | 'square' | 'butt'; -type StrokeLinejoin = 'round' | 'bevel' | 'miter'; - -const icons = Object.entries(iconsJson) - .map(([name, svg]) => { - const tags: Array = tagsJson[name] || []; - return { name, svg, tags }; - }) - .reduce((acc, icon) => { - acc[icon.name] = icon; - return acc; - }, {} as Record }>); +import { useSearchParam } from '../lib/use-search-param'; +import { icons } from '../lib/icons'; +import { Icon } from '../components/icon'; export function App() { const [query, setQuery] = useSearchParam('query', ''); @@ -71,17 +59,7 @@ export function App() { }, []); return ( -
+
@@ -93,16 +71,10 @@ export function App() {
- +
-

- Beautifully simple open-source icons designed on a 24×24 grid. -

+

Beautifully simple open-source icons designed on a 24px grid.

@@ -172,6 +132,12 @@ export function App() {
    {selectedIcon}
    - + { setSelectedIcon(''); }} > - +
-
- +
+
@@ -224,10 +197,10 @@ export function App() { SVG
- + - +
@@ -247,7 +220,7 @@ export function App() { Tags
- +
@@ -310,7 +283,7 @@ export function App() {
-
+
-
+
& { - name: string; - size?: string; - color?: string; -}) { - if (!icons[name]) { - return null; - } - - return ( - - ); -} - function IconButton(props: React.ComponentPropsWithoutRef<'button'>) { return (