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

67 lines
1.2 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;
2023-01-30 22:49:01 +01:00
---
2023-09-27 17:04:43 +02:00
<li class:list={["link-card",{ span }]} >
2023-01-30 23:56:31 +01:00
<a 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>
</a>
</li>
<style>
.link-card {
list-style: none;
display: flex;
padding: 0.15rem;
background-color: white;
background-image: var(--accent-gradient);
background-size: 400%;
border-radius: 0.5rem;
background-position: 100%;
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
2023-09-27 17:04:43 +02:00
.link-card.span {
grid-column: 1/-1;
}
2023-01-30 22:49:01 +01:00
.link-card > a {
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>