diff --git a/src/components/DynamicIcon.tsx b/src/components/DynamicIcon.tsx new file mode 100644 index 0000000..3296b0d --- /dev/null +++ b/src/components/DynamicIcon.tsx @@ -0,0 +1,38 @@ +import React from 'react'; +import * as FaIcons from 'react-icons/fa'; +import * as MdIcons from 'react-icons/md'; +import * as AiIcons from 'react-icons/ai'; +import * as GiIcons from 'react-icons/gi'; +import * as IoIcons from 'react-icons/io'; +import * as CiIcons from "react-icons/ci"; +import * as FiIcons from "react-icons/fi"; +import * as LuIcons from "react-icons/lu"; +import * as SiIcons from 'react-icons/si'; + +const iconSets = { + fa: FaIcons, + md: MdIcons, + ai: AiIcons, + gi: GiIcons, + io: IoIcons, + ci: CiIcons, + fi: FiIcons, + lu: LuIcons, + si: SiIcons, +}; + +const DynamicIcon = ({ name, set = 'fa', size = 20, color = 'currentColor', className = '' }: {name: string, set: string, size: number, color: string, className: string }) => { + let IconComponent = FaIcons.FaAlignCenter; + + if (name.startsWith("Fa")) { + IconComponent = iconSets["fa"][name] + } else if (name.startsWith("Si")) { + IconComponent = iconSets["si"][name] + } else { + IconComponent = iconSets[set][name]; + } + + return ; +}; + +export default DynamicIcon; diff --git a/src/pages/about.astro b/src/pages/about.astro index 856e896..5b9ad6f 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -1,7 +1,6 @@ --- import BaseLayout from '../layouts/BaseLayout.astro'; -import { FaJs, FaReact, FaNodeJs, FaPython } from 'react-icons/fa'; -import { SiTypescript, SiAstro } from 'react-icons/si'; +import DynamicIcon from '../components/DynamicIcon.tsx'; import directus from '../../lib/directus'; import { readSingleton, readItems } from '@directus/sdk'; @@ -107,7 +106,7 @@ const skills = await directus.request( - +

{ - skills.map((skill, index) => ( + [...skills, ...skills, ...skills].map((skill) => (
- +

{skill.title} diff --git a/tsconfig.json b/tsconfig.json index 1638910..a2dad7e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, + "allowImportingTsExtensions": true, "target": "ES6", "skipLibCheck": true, "strict": true,