Moved nice tools from fgo-ta over
This commit is contained in:
parent
e406bd8764
commit
7ed78bceff
10 changed files with 72 additions and 41 deletions
src/components
|
@ -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" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue