From da6333d39a834ba2cbd78386171c48b4b5230306 Mon Sep 17 00:00:00 2001 From: Xevion Date: Sat, 28 Dec 2024 18:00:57 -0600 Subject: [PATCH] font awesome dynamic icons, use dynamic /projects from directus --- src/pages/_document.tsx | 1 + src/pages/contact.tsx | 2 +- src/pages/projects.tsx | 156 +++++++--------------------------------- src/utils/directus.ts | 1 + 4 files changed, 27 insertions(+), 133 deletions(-) diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx index 0035c70..5465714 100644 --- a/src/pages/_document.tsx +++ b/src/pages/_document.tsx @@ -21,6 +21,7 @@ export default function Document() { sizes="16x16" href="/favicon-16x16.png" /> + diff --git a/src/pages/contact.tsx b/src/pages/contact.tsx index 3fba74d..fe4a4fd 100644 --- a/src/pages/contact.tsx +++ b/src/pages/contact.tsx @@ -30,7 +30,7 @@ const socials: { const ContactPage: NextPage = () => { return ( - +
diff --git a/src/pages/projects.tsx b/src/pages/projects.tsx index 431656f..2c01b86 100644 --- a/src/pages/projects.tsx +++ b/src/pages/projects.tsx @@ -1,146 +1,38 @@ -import { type NextPage } from "next"; import AppWrapper from "@/components/AppWrapper"; -import { RiMagicLine } from "react-icons/ri"; -import { BiBus, BiHash, BiNetworkChart } from "react-icons/bi"; +import directus, { Project } from "@/utils/directus"; +import { cn } from "@/utils/helpers"; +import { readItems } from "@directus/sdk"; +import { GetStaticPropsResult, type NextPage } from "next"; import Link from "next/link"; -import { IconType } from "react-icons"; -import { PiPlantBold } from "react-icons/pi"; -import { HiOutlineRss } from "react-icons/hi"; -import { GiHummingbird, GiPathDistance } from "react-icons/gi"; -import { - MdOutlineGrain, - MdOutlineDns, - MdOutlineLeaderboard, -} from "react-icons/md"; -import { FiLayers } from "react-icons/fi"; -import { FaReact } from "react-icons/fa"; -import { SiPowershell } from "react-icons/si"; -import { RxTimer } from "react-icons/rx"; -const ProjectsPage: NextPage = () => { - const projects: { - name: string; - description: string; - url?: string; - icon: IconType; - }[] = [ - { - name: "Portal", - description: "ACM Membership & Event System", - url: "https://portal.acmutsa.org", - icon: RiMagicLine, - }, - { - name: "Runnerspace", - description: "Hackathon MySpace Clone", - url: "https://runnerspace.xevion.dev", - icon: RiMagicLine, - }, - { - name: "v6 Place", - description: "Paint Images with IPv6 Addresses", - url: "https://github.com/Xevion/v6-place", - icon: BiNetworkChart, - }, - { - name: "Phototag", - description: "Effortlessly Tag Photos", - url: "/phototag", - icon: BiHash, - }, - { - name: "Paths", - description: "Graph Traversal Algorithms", - url: "https://github.com/Xevion/Paths", - icon: GiPathDistance, - }, - { - name: "undefined behaviors", - description: "Astro-based Blog", - url: "https://undefined.behavio.rs", - icon: HiOutlineRss, - }, - { - name: "v2.xevion.dev", - description: "Jekyll-based Blog", - url: "https://v2.xevion.dev", - icon: HiOutlineRss, - }, - { - name: "Grain", - description: "Pretty SVG-based Noise", - url: "https://grain.xevion.dev", - icon: MdOutlineGrain, - }, - { - name: "Hydroponics Expanded", - description: "A RimWorld Mod for Hydroponics", - url: "https://github.com/Xevion/RimWorld-Hydroponics-Expanded", - icon: PiPlantBold, - }, - { - name: "Time Banner", - description: "Instant PNG Timestamps in Rust", - url: "https://github.com/Xevion/time-banner", - icon: RxTimer, - }, - { - name: "The Office", - description: "View Quotes from The Office", - url: "https://the-office.xevion.dev", - icon: FiLayers, - }, - { - name: "Boids", - description: "Flocking Simulation", - url: "https://github.com/Xevion/Boids", - icon: GiHummingbird, - }, - { - name: "bus-reminder", - description: "Last Bus Departure Reminder", - url: "http://github.com/Xevion/bus-reminder", - icon: BiBus, - }, - { - name: "rdap", - description: "Javascript RDAP Client", - url: "https://rdap.xevion.dev", - icon: MdOutlineDns, - }, - { - name: "icons", - description: "Dynamic React-Icons Loading", - url: "https://icons.xevion.dev", - icon: FaReact, - }, - { - name: "trivia", - description: "CLI + Flask Leaderboard", - url: "http://github.com/Xevion/trivia", - icon: MdOutlineLeaderboard, - }, - { - name: "Powershell", - description: "Scripts & Guides", - url: "https://powershell.xevion.dev", - icon: SiPowershell, - }, - ]; +type Props = { + projects: Project[]; +}; + +export async function getStaticProps(): Promise> { + const projects = await directus.request(readItems("project")); + + return { + props: {projects} + } +} + +const ProjectsPage: NextPage = ({projects}) => { return ( - -
- {projects.map(({ name, description, url, icon: Icon }) => ( + +
+ {projects.map(({ name, shortDescription: description, links, icon }) => ( +
- +
{name}
diff --git a/src/utils/directus.ts b/src/utils/directus.ts index d0db103..241f3c9 100644 --- a/src/utils/directus.ts +++ b/src/utils/directus.ts @@ -14,6 +14,7 @@ export interface Technology { export interface Project { id: string; + icon: string | null; name: string; description: string; shortDescription: string;