Moved images to assets, rewrote to use Image component, fixed styling issues

This commit is contained in:
Firq 2023-12-25 18:39:44 +01:00
parent 709f459963
commit aec4660bec
Signed by: Firq
GPG key ID: 4DE1059A4666E89F
160 changed files with 386 additions and 331 deletions
src/components

View file

@ -1,16 +1,19 @@
---
import type { ImageMetadata } from 'astro';
import { Image } from 'astro:assets';
import mlb_ce from '../assets/ce/mlb.webp'
export interface Props {
name: string
link: string
imageFile: string
mlb: string
}
const { mlb, link, name } = Astro.props
const { mlb, imageFile, name } = Astro.props
const imagePath = `/src/assets/ce/${imageFile}`
const images_ces = import.meta.glob<{ default: ImageMetadata }>('/src/assets/ce/*.webp')
const ce_img: string = `/assets/ce/${link}.webp`
const mlb_ce: string = `/assets/ce/mlb.webp`
let mlb_image: string = 'mlbalign'
if (mlb === 'false') {
mlb_image = 'hidemlb'
}
@ -18,10 +21,10 @@ if (mlb === 'false') {
<article>
<div>
<img class="ce-crop" src={ce_img} alt={name} />
<Image src={images_ces[imagePath]()} alt={name} class="ce-crop"/>
</div>
<div class={mlb_image}>
<img class="mlb" src={mlb_ce} alt="Max-limit broken" />
<Image src={mlb_ce} alt="Max-limit broken" class="mlb"/>
</div>
</article>