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

90 lines
1.8 KiB
Text

---
import { Image } from 'astro:assets'
import type { GlobImage } from '../../types/generic'
import { plsLoadImage } from '../../utils/tools'
export interface Props {
site: string
link: string
imageFile: string
}
const { imageFile, link, site } = Astro.props
const imagePath = `/src/assets/social/${imageFile}`
const images_logos = import.meta.glob<GlobImage>(
'/src/assets/social/*.{png,webp}'
)
const loadedLogoImage = plsLoadImage(images_logos, imagePath)
---
<a
href={link}
target="_blank"
rel="noopener noreferrer"
aria-label=`${site} - new window`
>
<article class="contact do-hover">
<Image src={loadedLogoImage} alt="" loading={'eager'} width={128} height={128} quality={100}/>
<div>
<h2>{site}</h2>
</div>
</article>
<span class="visually-hidden">{site}</span>
</a>
<style>
a {
text-decoration: none;
--s-image: 80px;
}
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: var(--s-image);
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: var(--s-image);
height: var(--s-image);
opacity: 90%;
z-index: 100;
}
article:hover h2 {
display: inline-flex;
font-size: 16px;
font-weight: 500;
color: var(--c-primary-text);
}
</style>