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

90 lines
1.7 KiB
Text
Raw Normal View History

---
import type { ImageMetadata } from 'astro'
import { Image } from 'astro:assets'
export interface Props {
2023-03-09 10:44:18 +00:00
site: string
link: string
imageFile: string
}
const { imageFile, link, site } = Astro.props
const imagePath = `/src/assets/social/${imageFile}`
const images_logos = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/social/*.{png,webp}'
)
---
2023-03-11 18:59:51 +00:00
<a href={link} target="_blank" rel="noopener noreferrer" aria-label={site}>
2023-03-09 10:44:18 +00:00
<article class="contact do-hover">
<Image src={images_logos[imagePath]()} alt="" />
<div>
<h2>{site}</h2>
</div>
2023-03-09 10:44:18 +00:00
</article>
</a>
<style>
a {
text-decoration: none;
}
article {
--size-value: 6.25rem;
2023-07-08 13:02:07 +00:00
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;
2023-07-08 13:02:07 +00:00
width: var(--size-value);
height: var(--size-value);
}
article:hover div {
2023-07-08 13:02:07 +00:00
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;
2023-03-09 10:44:18 +00:00
color: white;
font-size: 18px;
}
article h2 {
position: absolute;
display: none;
}
article div {
display: none;
}
2023-03-09 10:44:18 +00:00
a:hover {
transform: scale(var(--hover-scale));
}
</style>