firq-dev-website/src/components/cards/favouriteCard.astro

97 lines
2 KiB
Text
Raw Normal View History

---
2024-01-20 16:21:51 +01:00
import { Image } from 'astro:assets'
2024-07-19 22:52:15 +02:00
import type { GlobImage } from '../../types/generic'
import { plsLoadImage } from '../../utils/tools'
export interface Props {
2023-03-09 11:44:18 +01:00
name: string
origin: string
imageFile: string
link: string
}
const { link, imageFile, origin, name } = Astro.props
const imagePath = `/src/assets/favourites/${imageFile}`
2024-01-20 16:21:51 +01:00
const images = import.meta.glob<GlobImage>(
'/src/assets/favourites/*.{png,webp}'
)
2024-01-05 01:12:19 +01:00
const loadedImage = plsLoadImage(images, imagePath)
---
2024-01-20 16:21:51 +01:00
<a
href={link}
target="_blank"
rel="noopener noreferrer"
aria-label=`${name} - new window`
>
2023-03-11 00:18:33 +01:00
<div class="heading">{name}</div>
2024-10-26 17:37:35 +02:00
<Image src={loadedImage} alt={name} loading={'eager'} width={128} height={128} quality={100}/>
2023-03-11 00:18:33 +01:00
<h2 class="subtext">
{origin}
</h2>
</a>
<style>
2023-03-09 11:44:18 +01:00
.heading {
display: flex;
2024-10-22 21:15:24 +02:00
height: fit-content;
min-height: 2.5rem;
line-height: 1.75rem;
2023-07-06 19:41:28 +02:00
font-size: 24px;
2024-10-24 18:52:33 +02:00
color: var(--c-primary-text);
2023-03-09 11:44:18 +01:00
max-width: 200px;
padding-bottom: 0.3rem;
2024-10-25 15:26:25 +02:00
font-weight: 500;
2023-03-09 11:44:18 +01:00
margin: 0px;
justify-content: center;
align-items: center;
}
2023-03-11 00:18:33 +01:00
a {
2025-04-17 20:06:18 +02:00
transition: border-color var(--a-time-default) var(--a-animation-1);
2023-07-06 19:41:28 +02:00
border-radius: 1rem;
2023-03-09 11:44:18 +01:00
display: flex;
flex-wrap: wrap;
flex-direction: column;
2024-10-24 18:52:33 +02:00
background-color: var(--c-primary-background);
2024-10-22 21:15:24 +02:00
padding: 0em 0.25em;
width: max(40%, 128px);
2023-03-09 11:44:18 +01:00
height: auto;
justify-content: center;
align-items: center;
text-align: center;
2023-03-11 00:18:33 +01:00
text-decoration: none;
2024-10-24 18:52:33 +02:00
border: 2px var(--c-primary-background) solid;
2024-01-20 16:21:51 +01:00
&:hover {
2024-10-24 18:52:33 +02:00
border: 2px var(--c-accent-1) solid;
2024-01-20 16:21:51 +01:00
}
img {
2024-10-22 21:15:24 +02:00
width: min(90%, 100px);
margin: 0px 0.5rem;
2024-01-20 16:21:51 +01:00
height: auto;
border-radius: 1rem;
2024-01-20 16:21:51 +01:00
}
2023-03-09 11:44:18 +01:00
}
2023-03-09 11:44:18 +01:00
@media (min-width: 512px) {
2023-03-11 00:18:33 +01:00
a {
2023-03-09 11:44:18 +01:00
padding: 10px 10px;
width: auto;
height: auto;
2024-01-20 16:21:51 +01:00
img {
2024-10-26 17:37:35 +02:00
width: 128px;
2024-01-20 16:21:51 +01:00
}
}
2023-03-09 11:44:18 +01:00
}
.subtext {
2024-10-24 18:52:33 +02:00
color: var(--c-primary-text);
2023-03-09 11:44:18 +01:00
font-size: 16px;
2024-10-25 15:26:25 +02:00
font-weight: 400;
margin: 0.5rem;
2023-03-09 11:44:18 +01:00
line-height: 20px;
}
</style>