les-particules-org/src/components/Card.astro

66 lines
1.1 KiB
Text

---
export interface Props {
title: string;
href: string;
target: string;
span?: boolean
}
const { href, target, title, span} = Astro.props;
const Wrapper = href ? 'a' : 'div'
---
<li class:list={["link-card",{ span }]} >
<Wrapper class="content" href={href} target={target}>
<h2>
{title}
<span>&rarr;</span>
</h2>
<p>
<slot />
</p>
</Wrapper>
</li>
<style>
.link-card {
list-style: none;
display: flex;
padding: 0.15rem;
background-color: white;
background-size: 400%;
border-radius: 0.5rem;
box-shadow: 0.2em 0.2em 1em black;
max-width: 80ch;
}
.link-card.span {
grid-column: 1/-1;
}
.link-card > .content {
width: 100%;
text-decoration: none;
line-height: 1.4;
padding: 1rem 1.3rem;
border-radius: 0.35rem;
color: #111;
background-color: white;
opacity: 0.8;
}
h2 {
margin: 0;
font-size: 1.25rem;
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
p {
margin-top: 0.5rem;
margin-bottom: 0;
color: #444;
}
.link-card:is(:hover, :focus-within) {
background-position: 0;
}
.link-card:is(:hover, :focus-within) h2 {
color: rgb(var(--accent));
}
</style>