87 lines
1.7 KiB
Text
87 lines
1.7 KiB
Text
---
|
|
export interface Props {
|
|
title: string
|
|
body: string
|
|
href: string
|
|
newTab?: boolean
|
|
rel?: string
|
|
}
|
|
|
|
const { href, title, rel, body, newTab = false } = Astro.props
|
|
---
|
|
|
|
<li class="link-card">
|
|
<a rel={rel || null} href={href} target={newTab ? '_blank' : null}>
|
|
<h2>
|
|
{title}
|
|
{newTab ? <span> ↗</span> : <span> →</span>}
|
|
</h2>
|
|
<p>
|
|
{body}
|
|
</p>
|
|
</a>
|
|
</li>
|
|
|
|
<style>
|
|
:root {
|
|
--link-gradient: linear-gradient(
|
|
45deg,
|
|
var(--color-brand-blue-1),
|
|
var(--color-brand-blue-3) 30%,
|
|
var(--color-border) 60%
|
|
);
|
|
}
|
|
|
|
.link-card {
|
|
list-style: none;
|
|
display: flex;
|
|
padding: 0.15rem;
|
|
background-size: 400%;
|
|
border-radius: 0.5rem;
|
|
background-position: 100%;
|
|
background-image: var(--link-gradient);
|
|
transition: background-position 0.6s cubic-bezier(0.22, 1, 0.36, 1);
|
|
}
|
|
|
|
.link-card > a {
|
|
width: 100%;
|
|
text-decoration: none;
|
|
padding: 1em;
|
|
border-radius: 0.35rem;
|
|
background-color: white;
|
|
color: var(--text-color-dark);
|
|
}
|
|
|
|
h2 {
|
|
margin: 0;
|
|
font-size: var(--font-size-base);
|
|
transition: color 0.6s cubic-bezier(0.22, 1, 0.36, 1);
|
|
}
|
|
|
|
p {
|
|
font-weight: normal;
|
|
margin-top: 0.75rem;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
h2 span {
|
|
display: inline-block;
|
|
transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
|
|
}
|
|
|
|
.link-card:is(:hover, :focus-within) {
|
|
background-position: 0;
|
|
}
|
|
|
|
.link-card:is(:hover, :focus-within) h2 span {
|
|
will-change: transform;
|
|
transform: translateX(2px);
|
|
}
|
|
|
|
@media (prefers-color-scheme: dark) {
|
|
.link-card > a {
|
|
background-color: var(--bg-dark);
|
|
color: var(--text-color-light);
|
|
}
|
|
}
|
|
</style>
|