From c58abda2af5992842491c2f4a1e776d1d5d92ae8 Mon Sep 17 00:00:00 2001 From: Adam Plesnik Date: Wed, 2 Oct 2024 13:50:02 +0200 Subject: [PATCH] Add custom Icon component --- src/components/Icon.test.tsx | 17 +++ src/components/Icon.tsx | 8 ++ src/components/Tile.tsx | 3 +- .../__snapshots__/Icon.test.tsx.snap | 117 ++++++++++++++++++ src/content/Tech.tsx | 15 +-- 5 files changed, 152 insertions(+), 8 deletions(-) create mode 100644 src/components/Icon.test.tsx create mode 100644 src/components/Icon.tsx create mode 100644 src/components/__snapshots__/Icon.test.tsx.snap diff --git a/src/components/Icon.test.tsx b/src/components/Icon.test.tsx new file mode 100644 index 0000000..faae3b6 --- /dev/null +++ b/src/components/Icon.test.tsx @@ -0,0 +1,17 @@ +import { toJson } from '@/utils/toJson' +import { Cog } from 'lucide-react' +import renderer from 'react-test-renderer' +import { expect, test } from 'vitest' +import Icon from './Icon' + +test('Icon', () => { + const component = renderer.create() + const tree = toJson(component) + expect(tree).toMatchSnapshot() +}) + +test('Icon with class name', () => { + const component = renderer.create() + const tree = toJson(component) + expect(tree).toMatchSnapshot() +}) diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx new file mode 100644 index 0000000..a4f2447 --- /dev/null +++ b/src/components/Icon.tsx @@ -0,0 +1,8 @@ +import clsx from 'clsx' +import { LucideIcon } from 'lucide-react' + +const Icon = ({ Icon, className }: { Icon: LucideIcon; className?: string }) => { + return +} + +export default Icon diff --git a/src/components/Tile.tsx b/src/components/Tile.tsx index 6757bd3..fbb4cf3 100644 --- a/src/components/Tile.tsx +++ b/src/components/Tile.tsx @@ -2,6 +2,7 @@ import { clsx } from 'clsx' import { MousePointerClick } from 'lucide-react' import { HTMLAttributes, PropsWithChildren, ReactNode } from 'react' import Heading from './Heading' +import Icon from './Icon' const Tile = ({ sub, @@ -20,7 +21,7 @@ const Tile = ({ {children} {links && (
- +
{links}
)} diff --git a/src/components/__snapshots__/Icon.test.tsx.snap b/src/components/__snapshots__/Icon.test.tsx.snap new file mode 100644 index 0000000..e3120d3 --- /dev/null +++ b/src/components/__snapshots__/Icon.test.tsx.snap @@ -0,0 +1,117 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Icon 1`] = ` + + + + + + + + + + + + + + + + +`; + +exports[`Icon with class name 1`] = ` + + + + + + + + + + + + + + + + +`; diff --git a/src/content/Tech.tsx b/src/content/Tech.tsx index 8cd7623..f89a757 100644 --- a/src/content/Tech.tsx +++ b/src/content/Tech.tsx @@ -1,19 +1,20 @@ import Em from '@/components/Em' +import Icon from '@/components/Icon' import Tile from '@/components/Tile' import { Sparkles } from 'lucide-react' const skills: { tech: string; description: string }[] = [ { tech: 'React', - description: 'TSX, state as minimal as it gets, queries, micro components, API.', + description: 'TSX, state, queries, micro components, API.', }, - { tech: 'Tailwind CSS', description: 'Atomic CSS everywhere.' }, - { tech: 'CSS + Sass', description: 'Where the Tailwind CSS is not enough.' }, + { tech: 'Tailwind CSS', description: 'Utility first.' }, + { tech: 'HTML, CSS, Sass', description: 'SEO, a11y, animations, transitions.' }, { tech: 'Theme refactoring', - description: 'Reorganization and tuning of front-end parts of large app', + description: 'Reorganization and tuning of front-end.', }, - { tech: 'Figma', description: 'Mockups and prototypes.' }, + { tech: 'Figma', description: 'Mockups and prototypes, design systems, modes.' }, { tech: '...and more', description: 'Payload CMS, Angular, Vue.js, Vaadin + Java' }, ] @@ -23,10 +24,10 @@ const Tech = () => {
    {skills.map((skill, i) => (
  • - + {skill.tech} - {skill.description} + {skill.description}
  • ))}