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

67 lines
1.1 KiB
Text
Raw Normal View History

2023-01-30 22:49:01 +01:00
---
export interface Props {
title: string;
href: string;
2023-01-30 23:56:31 +01:00
target: string;
2023-09-27 16:56:51 +02:00
span?: boolean
2023-01-30 22:49:01 +01:00
}
2023-09-27 16:56:51 +02:00
const { href, target, title, span} = Astro.props;
2024-01-02 00:34:17 +01:00
const Wrapper = href ? 'a' : 'div'
2023-01-30 22:49:01 +01:00
---
2023-09-27 17:04:43 +02:00
<li class:list={["link-card",{ span }]} >
2024-01-02 00:34:17 +01:00
<Wrapper class="content" href={href} target={target}>
2023-01-30 22:49:01 +01:00
<h2>
{title}
<span>&rarr;</span>
</h2>
<p>
2023-09-27 16:10:38 +02:00
<slot />
2023-01-30 22:49:01 +01:00
</p>
2024-01-02 00:34:17 +01:00
</Wrapper>
2023-01-30 22:49:01 +01:00
</li>
<style>
.link-card {
list-style: none;
display: flex;
padding: 0.15rem;
background-color: white;
background-size: 400%;
border-radius: 0.5rem;
2024-01-02 00:34:17 +01:00
box-shadow: 0.2em 0.2em 1em black;
max-width: 80ch;
2023-01-30 22:49:01 +01:00
}
2023-09-27 17:04:43 +02:00
.link-card.span {
grid-column: 1/-1;
}
2023-01-30 22:49:01 +01:00
2024-01-02 00:34:17 +01:00
.link-card > .content {
2023-01-30 22:49:01 +01:00
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>