feat: implement category-based filtering in Dashboard and add dynamic category pages
This commit is contained in:
@@ -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 <>
|
||||
<CategoryNav filter={filter} setFilter={setFilter} />
|
||||
<CardsContainer filter={filter} />
|
||||
</>
|
||||
}
|
||||
export default function Dashboard({ category }) {
|
||||
return (
|
||||
<>
|
||||
<CategoryNav filter={category} />
|
||||
<CardsContainer filter={category} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
50
src/pages/categories/[category].astro
Normal file
50
src/pages/categories/[category].astro
Normal file
@@ -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;
|
||||
---
|
||||
|
||||
<Layout
|
||||
site=`Rise of Machine - ${category}`
|
||||
title="Make the Most of It"
|
||||
tagline="Discover AI tools curated for makers and SMBs."
|
||||
>
|
||||
<main>
|
||||
<Dashboard client:load category=`${category}` />
|
||||
</main>
|
||||
</Layout>
|
||||
@@ -15,6 +15,6 @@ import Dashboard from "../components/Dashboard";
|
||||
tagline="Discover AI tools curated for makers and SMBs."
|
||||
>
|
||||
<main>
|
||||
<Dashboard client:load />
|
||||
<Dashboard client:load category='all' />
|
||||
</main>
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user