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

119 lines
2 KiB
Text
Raw Normal View History

---
import type { ImageMetadata } from 'astro';
import { Image } from 'astro:assets';
import mlb_ce from '../assets/ce/mlb.webp'
export interface Props {
2023-03-09 11:44:18 +01:00
name: string
imageFile: string
2023-03-09 11:44:18 +01:00
mlb: string
}
const { mlb, imageFile, name } = Astro.props
const imagePath = `/src/assets/ce/${imageFile}`
const images_ces = import.meta.glob<{ default: ImageMetadata }>('/src/assets/ce/*.webp')
2023-03-09 11:44:18 +01:00
let mlb_image: string = 'mlbalign'
if (mlb === 'false') {
mlb_image = 'hidemlb'
}
---
<article>
2023-03-09 11:44:18 +01:00
<div>
<Image src={images_ces[imagePath]()} alt={name} class="ce-crop"/>
2023-03-09 11:44:18 +01:00
</div>
<div class={mlb_image}>
<Image src={mlb_ce} alt="Max-limit broken" class="mlb"/>
2023-03-09 11:44:18 +01:00
</div>
</article>
<style>
2023-03-09 11:44:18 +01:00
.hidemlb {
display: none;
height: 1em;
}
2023-03-09 11:44:18 +01:00
article {
2023-07-07 18:32:14 +02:00
border-radius: 1.25rem;
2023-03-09 11:44:18 +01:00
background-color: var(--c-darkergray);
padding: 20px;
padding-top: 5px;
width: 35%;
height: auto;
justify-content: center;
text-align: center;
transition: transform var(--speed) var(--ease);
margin: 0px;
display: grid;
grid-template-columns: 100%;
2023-07-07 18:32:14 +02:00
grid-template-rows: auto 3em;
2023-03-09 11:44:18 +01:00
gap: 0px 0px;
grid-auto-flow: row;
grid-template-areas:
'.'
'.';
}
2023-03-09 11:44:18 +01:00
article:hover {
transform: scale(var(--hover-scale));
}
2023-03-09 11:44:18 +01:00
article div {
margin: 0.5em auto;
}
2023-03-09 11:44:18 +01:00
img {
2023-07-07 18:32:14 +02:00
border-radius: 1.5rem;
margin-top: 1rem;
2023-03-09 11:44:18 +01:00
display: flex;
margin-left: auto;
margin-right: auto;
}
2023-03-09 11:44:18 +01:00
.heading-center {
display: flex;
height: 4rem;
width: 100%;
align-items: center;
justify-content: center;
font-size: 1.25em;
color: white;
font-weight: bold;
}
.ce-crop {
width: 6em;
height: 6em;
}
2023-03-09 11:44:18 +01:00
.mlb {
2023-07-07 18:40:56 +02:00
width: 5.5rem;
2023-03-09 11:44:18 +01:00
margin-left: auto;
margin-right: auto;
}
.mlbalign {
display: flex;
justify-items: center;
align-items: center;
}
@media (min-width: 512px) {
.ce-crop {
2023-03-09 11:44:18 +01:00
width: 7.5em;
height: 7.5em;
}
2023-03-09 11:44:18 +01:00
article {
width: 10em;
}
2023-01-23 19:00:16 +01:00
.mlbalign {
2023-03-09 11:44:18 +01:00
width: 7.5em;
}
2023-07-07 18:40:56 +02:00
.mlb {
width: 7rem;
}
2023-03-09 11:44:18 +01:00
}
</style>