99 lines
2 KiB
Text
99 lines
2 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 logoAltText = `${site} Logo`
|
|
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={logoAltText} />
|
|
<div>
|
|
<h2>{site}</h2>
|
|
</div>
|
|
</article>
|
|
<span class="visually-hidden">{logoAltText}</span>
|
|
</a>
|
|
|
|
<style>
|
|
a {
|
|
text-decoration: none;
|
|
}
|
|
|
|
article {
|
|
--size-value: 6.25rem;
|
|
border-radius: 1.25rem;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
background-color: var(--c-darkergray);
|
|
border-color: var(--c-darkgray);
|
|
padding: 10px;
|
|
text-align: center;
|
|
transition: transform var(--speed) var(--ease);
|
|
height: auto;
|
|
width: auto;
|
|
position: relative;
|
|
}
|
|
|
|
article img {
|
|
border-radius: 1.25rem;
|
|
width: var(--size-value);
|
|
height: var(--size-value);
|
|
}
|
|
|
|
article:hover div {
|
|
border-radius: 1.25rem;
|
|
padding: 0 0.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
background-color: var(--c-darkgray);
|
|
height: calc(var(--size-value));
|
|
width: calc(var(--size-value) - 1rem);
|
|
opacity: 90%;
|
|
z-index: 100;
|
|
position: absolute;
|
|
}
|
|
|
|
article:hover h2 {
|
|
margin: 0;
|
|
display: inline-flex;
|
|
font-weight: bold;
|
|
color: white;
|
|
font-size: 18px;
|
|
}
|
|
|
|
article h2 {
|
|
position: absolute;
|
|
display: none;
|
|
}
|
|
|
|
article div {
|
|
display: none;
|
|
}
|
|
|
|
a:hover {
|
|
transform: scale(var(--hover-scale));
|
|
}
|
|
</style>
|