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

91 lines
1.8 KiB
Text
Raw Normal View History

---
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
site: string
link: string
imageFile: string
}
const { imageFile, link, site } = Astro.props
const imagePath = `/src/assets/social/${imageFile}`
2024-01-05 01:12:19 +01:00
const images_logos = import.meta.glob<GlobImage>(
'/src/assets/social/*.{png,webp}'
)
2024-01-05 01:12:19 +01:00
const loadedLogoImage = plsLoadImage(images_logos, imagePath)
---
2024-01-05 01:12:19 +01:00
<a
href={link}
target="_blank"
rel="noopener noreferrer"
aria-label=`${site} - new window`
>
2023-03-09 11:44:18 +01:00
<article class="contact do-hover">
2024-10-24 18:52:33 +02:00
<Image src={loadedLogoImage} alt="" loading={'eager'} width={128} height={128} quality={100}/>
<div>
<h2>{site}</h2>
</div>
2023-03-09 11:44:18 +01:00
</article>
2024-10-24 18:52:33 +02:00
<span class="visually-hidden">{site}</span>
</a>
<style>
a {
text-decoration: none;
2024-10-26 13:51:37 +02:00
--s-image: 80px;
}
article {
2023-07-08 15:02:07 +02:00
display: flex;
2024-10-24 18:52:33 +02:00
position: relative;
align-items: center;
2024-10-24 18:52:33 +02:00
justify-content: center;
text-align: center;
2024-10-24 18:52:33 +02:00
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;
2024-10-26 13:51:37 +02:00
width: var(--s-image);
2024-10-24 18:52:33 +02:00
height: auto;
}
article div {
display: none;
}
article:hover {
border-color: var(--c-accent-1);
2023-07-08 15:02:07 +02:00
}
article:hover div {
display: flex;
2024-10-24 18:52:33 +02:00
position: absolute;
margin: unset;
align-items: center;
justify-content: center;
text-align: center;
2024-10-24 18:52:33 +02:00
background-color: var(--c-primary-background);
border-radius: 1.25rem;
2024-10-26 13:51:37 +02:00
width: var(--s-image);
height: var(--s-image);
opacity: 90%;
z-index: 100;
}
article:hover h2 {
display: inline-flex;
2024-10-24 18:52:33 +02:00
font-size: 16px;
font-weight: 500;
color: var(--c-primary-text);
2023-03-09 11:44:18 +01:00
}
</style>