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,6 +1,7 @@
|
|||
---
|
||||
import type { ImageMetadata } from 'astro'
|
||||
import { Image } from 'astro:assets'
|
||||
import type { GlobImage } from '../types/generic'
|
||||
import { plsLoadImage } from '../utils/tools'
|
||||
|
||||
export interface Props {
|
||||
title: string
|
||||
|
@ -11,14 +12,15 @@ export interface Props {
|
|||
const { imageFile, link, title } = Astro.props
|
||||
const logoAltText = `${title} Logo`
|
||||
const imagePath = `/src/assets/technologies/${imageFile}`
|
||||
const images_logos = import.meta.glob<{ default: ImageMetadata }>(
|
||||
const images_logos = import.meta.glob<GlobImage>(
|
||||
'/src/assets/technologies/*.{png,webp}'
|
||||
)
|
||||
const loadedImage = plsLoadImage(images_logos, imagePath)
|
||||
---
|
||||
|
||||
<a href={link} target="_blank" rel="noopener noreferrer" aria-label={title}>
|
||||
<article>
|
||||
<Image src={images_logos[imagePath]()} alt={logoAltText} />
|
||||
<Image src={loadedImage} alt={logoAltText} />
|
||||
<div>
|
||||
<h2>{title}</h2>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue