From 75dadabc5830c3cd40a8d3de412092bcca11ab39 Mon Sep 17 00:00:00 2001 From: Caleb Joshua Date: Tue, 19 Nov 2024 04:32:15 +0530 Subject: [PATCH] feat: implement category-based filtering in Dashboard and add dynamic category pages --- src/components/Dashboard.jsx | 18 +++++----- src/pages/categories/[category].astro | 50 +++++++++++++++++++++++++++ src/pages/index.astro | 2 +- 3 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 src/pages/categories/[category].astro diff --git a/src/components/Dashboard.jsx b/src/components/Dashboard.jsx index ccc373f..a59b712 100644 --- a/src/components/Dashboard.jsx +++ b/src/components/Dashboard.jsx @@ -1,13 +1,11 @@ -import { useState } from "react"; import CategoryNav from "./CategoryNav"; import CardsContainer from "./CardsContainer"; -export default function Dashboard() { - - const [filter, setFilter] = useState("all"); - - return <> - - - -} \ No newline at end of file +export default function Dashboard({ category }) { + return ( + <> + + + + ); +} diff --git a/src/pages/categories/[category].astro b/src/pages/categories/[category].astro new file mode 100644 index 0000000..17dd588 --- /dev/null +++ b/src/pages/categories/[category].astro @@ -0,0 +1,50 @@ +--- +import Layout from "../../layouts/Layout.astro"; + +import "@new-ui/reset"; +import "@new-ui/colors"; +import "@new-ui/typography"; +import "@new-ui/effects"; +import "@new-ui/spacings"; +import Dashboard from "../../components/Dashboard"; + +export function getStaticPaths() { + return [ + {params: {category: 'all'}}, + {params: {category: 'art'}}, + {params: {category: 'audio'}}, + {params: {category: 'code'}}, + {params: {category: 'copywriting'}}, + {params: {category: 'design'}}, + {params: {category: 'developer'}}, + {params: {category: 'education'}}, + {params: {category: 'enterprise'}}, + {params: {category: 'fashion'}}, + {params: {category: 'gaming'}}, + {params: {category: 'health'}}, + {params: {category: 'legal'}}, + {params: {category: 'llm'}}, + {params: {category: 'music'}}, + {params: {category: 'nocode'}}, + {params: {category: 'photos'}}, + {params: {category: 'productivity'}}, + {params: {category: 'prompts'}}, + {params: {category: 'research'}}, + {params: {category: 'seo'}}, + {params: {category: 'social'}}, + {params: {category: 'xtras'}}, + ]; +} + +const { category } = Astro.params; +--- + + +
+ +
+
\ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 001b54b..491be30 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -15,6 +15,6 @@ import Dashboard from "../components/Dashboard"; tagline="Discover AI tools curated for makers and SMBs." >
- +