Moved nice tools from fgo-ta over

This commit is contained in:
Firq 2024-01-05 01:12:19 +01:00
parent e406bd8764
commit 7ed78bceff
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20
10 changed files with 72 additions and 41 deletions
src/components

View file

@ -1,7 +1,8 @@
---
import type { ImageMetadata } from 'astro'
import { Image } from 'astro:assets'
import mlb_ce from '../assets/ce/mlb.webp'
import type { GlobImage } from '../types/generic'
import { plsLoadImage } from '../utils/tools'
export interface Props {
name: string
@ -11,19 +12,15 @@ export interface Props {
const { mlb, imageFile, name } = Astro.props
const imagePath = `/src/assets/ce/${imageFile}`
const images_ces = import.meta.glob<{ default: ImageMetadata }>(
'/src/assets/ce/*.png'
)
const images_ces = import.meta.glob<GlobImage>('/src/assets/ce/*.png')
const loadedCEImage = plsLoadImage(images_ces, imagePath)
let mlb_image: string = 'mlbalign'
if (mlb === 'false') {
mlb_image = 'hidemlb'
}
const mlb_image = mlb ? 'mlbalign' : 'hidemlb'
---
<article>
<div>
<Image src={images_ces[imagePath]()} alt={name} class="ce-crop" />
<Image src={loadedCEImage} alt={name} class="ce-crop" />
</div>
<div class={mlb_image}>
<Image src={mlb_ce} alt="Max-limit broken" class="mlb" />