firq-dev-website/src/components/cards/technologyCard.astro
2024-10-29 22:17:38 +01:00

88 lines
1.8 KiB
Text

---
import { Image } from 'astro:assets'
import type { GlobImage } from '../../types/generic'
import { plsLoadImage } from '../../utils/tools'
export interface Props {
title: string
link: string
imageFile: string
}
const { imageFile, link, title } = Astro.props
const imagePath = `/src/assets/technologies/${imageFile}`
const images_logos = import.meta.glob<GlobImage>(
'/src/assets/technologies/*.{png,webp}'
)
const loadedImage = plsLoadImage(images_logos, imagePath)
---
<a href={link} target="_blank" rel="noopener noreferrer" aria-label={title}>
<article>
<Image src={loadedImage} alt="" loading={'eager'} width={150} height={150} quality={100}/>
<div>
<h2>{title}</h2>
</div>
</article>
<span class="visually-hidden">{title}</span>
</a>
<style>
* {
transition: all var(--a-time-default) var(--a-animation-1);
}
a {
text-decoration: none;
}
article {
display: flex;
position: relative;
align-items: center;
justify-content: center;
text-align: center;
background-color: var(--c-primary-background);
border: 2px solid var(--c-primary-background);
border-radius: 1.25rem;
padding: 6px;
height: auto;
width: auto;
}
article img {
border-radius: 1.25rem;
width: 80px;
height: auto;
}
article div {
display: none;
}
article:hover {
border-color: var(--c-accent-1);
}
article:hover div {
display: flex;
position: absolute;
margin: unset;
align-items: center;
justify-content: center;
text-align: center;
background-color: var(--c-primary-background);
border-radius: 1.25rem;
width: 80px;
height: 80px;
opacity: 90%;
z-index: 100;
}
article:hover h2 {
display: inline-flex;
font-size: 16px;
font-weight: 500;
color: var(--c-primary-text);
}
</style>