120 lines
3.4 KiB
Plaintext
120 lines
3.4 KiB
Plaintext
---
|
|
import Layout from '../../layouts/Layout.astro';
|
|
// import { useState, useEffect } from 'react';
|
|
import { allCategories } from '../../data/categories';
|
|
import { allProducts } from '../../data/products';
|
|
import ProductCard from '../../components/ProductCard.astro';
|
|
|
|
type CategoryStaticPath = { params: { categoryLookup: string }};
|
|
|
|
export function getStaticPaths() {
|
|
return allCategories.map<CategoryStaticPath>((category) => { return {
|
|
params: {
|
|
categoryLookup: category.seoLink
|
|
}
|
|
}});
|
|
}
|
|
console.log(getStaticPaths());
|
|
|
|
const { categoryLookup } = Astro.params;
|
|
const category = allCategories.find(c => c.seoLink === categoryLookup)!;
|
|
const categoryProducts = allProducts.filter(p => p.categoryId === category.id)!;
|
|
---
|
|
|
|
<Layout title={`${category.category} - Dasher Supply`}>
|
|
<main>
|
|
<h1 class="center"><a href="/"><span class="text-gradient">Dasher Supply</span></a> > {category.category}</h1>
|
|
<p class="instructions">
|
|
{category.description}
|
|
</p>
|
|
<!-- <div role="row"> -->
|
|
<ul role="list" class="link-card-grid">
|
|
{categoryProducts.map((product, id) => (
|
|
<ProductCard
|
|
product={product}
|
|
/>
|
|
))}
|
|
</ul>
|
|
<!-- </div> -->
|
|
<br />
|
|
<div class="disclaimers">
|
|
<p>Dasher Supply is not endorsed by or affiliated with DoorDash. As an Amazon Associate I earn from qualifying purchases.</p>
|
|
<a href="/about">About this site.</a>
|
|
</div>
|
|
</main>
|
|
</Layout>
|
|
|
|
<style>
|
|
main {
|
|
margin: auto;
|
|
padding: 1rem;
|
|
min-width: 800px;
|
|
max-width: calc(100% - 2rem);
|
|
color: white;
|
|
font-size: 20px;
|
|
line-height: 1.6;
|
|
}
|
|
.center {
|
|
text-align: center;
|
|
}
|
|
h1 {
|
|
font-size: 4rem;
|
|
font-weight: 700;
|
|
line-height: 1;
|
|
margin-bottom: 1em;
|
|
font-family: "Holtwood One SC", sans-serif;
|
|
font-weight: 600;
|
|
font-style: bold;
|
|
/* text-shadow: -5px -5px 0 rgba(var(--accent-dark), 17%), 3px -3px 0 rgba(var(--accent-light), 10%), -2px 2px 0 rgba(var(--accent-light), 5%), 5px 5px 0 rgba(var(--accent-light), 10%); */
|
|
}
|
|
.text-gradient {
|
|
background-image: var(--accent-gradient);
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
background-size: 400%;
|
|
background-position: 0%;
|
|
}
|
|
.disclaimers {
|
|
margin-bottom: 2rem;
|
|
border: 1px solid rgba(var(--accent-light), 25%);
|
|
background: linear-gradient(rgba(var(--accent-dark), 66%), rgba(var(--accent-dark), 33%));
|
|
padding: 1.5rem;
|
|
border-radius: 8px;
|
|
font-family: "Urbanist", sans-serif;
|
|
font-weight: 400;
|
|
font-style: normal;
|
|
}
|
|
.instructions {
|
|
margin-bottom: 2rem;
|
|
border: 1px solid rgba(var(--accent-light), 25%);
|
|
background: linear-gradient(rgba(var(--accent-dark), 66%), rgba(var(--accent-dark), 33%));
|
|
padding: 0.5rem;
|
|
border-radius: 8px;
|
|
font-family: "Caveat", cursive;
|
|
font-weight: 400;
|
|
font-style: normal;
|
|
font-size: 2.5rem;
|
|
text-align: center;
|
|
}
|
|
.instructions code {
|
|
font-size: 0.8em;
|
|
font-weight: bold;
|
|
background: rgba(var(--accent-light), 12%);
|
|
color: rgb(var(--accent-light));
|
|
border-radius: 4px;
|
|
padding: 0.3em 0.4em;
|
|
}
|
|
.instructions strong {
|
|
color: rgb(var(--accent-light));
|
|
}
|
|
.link-card-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(48ch, 1fr));
|
|
/* grid-template-columns: repeat(3, 1fr); */
|
|
gap: 2rem;
|
|
padding: 0;
|
|
}
|
|
a, a:link, a:visited { text-decoration: none; color: #fff }
|
|
a:hover, a:active { text-decoration: underline; color: #fff }
|
|
</style>
|