dashersupply/src/components/CategoryCard.astro

66 lines
1.4 KiB
Plaintext

---
import type { Category } from '../data/categories';
interface Props {
category: Category
}
const { category } = Astro.props;
---
<li class="category-card">
<a href={`/category/${category.slug}`}>
{category.imageUrl !== undefined && <img src={category.imageUrl} alt={category.category} />}
<h2>
{category.category}
<span>&rarr;</span>
</h2>
<p>
{category.description}
</p>
</a>
</li>
<style>
.category-card {
list-style: none;
display: flex;
padding: 1px;
background-color: #23262d;
background-image: none;
background-size: 400%;
border-radius: 7px;
background-position: 100%;
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.category-card > a {
width: 100%;
text-decoration: none;
line-height: 1.4;
padding: calc(1.5rem - 1px);
border-radius: 8px;
color: white;
background-color: #23262d;
opacity: 0.8;
}
.category-card img {
max-width: 100%;
}
.category-card h2 {
margin: 0;
font-size: 1.25rem;
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.category-card p {
margin-top: 0.5rem;
margin-bottom: 0;
}
.category-card:is(:hover, :focus-within) {
background-position: 0;
background-image: var(--accent-gradient);
}
.category-card:is(:hover, :focus-within) h2 {
color: rgb(var(--accent-light));
}
</style>