format all code (#386)

This commit is contained in:
Katsuyuki Karasawa authored and GitHub committed 2025-04-08 23:08:31 +09:00
1 parent 7ea2f7f40f
commit 286b050fa8
61 files changed
+1329 -1307

No files matched your search

+33 -31
View File
@@ -1,47 +1,49 @@
---
import path from 'node:path'
import path from "node:path";
interface Props {
id?: string
src: string
class?: string
alt?: string
position?: string
basePath?: string
id?: string;
src: string;
class?: string;
alt?: string;
position?: string;
basePath?: string;
}
import { Image } from 'astro:assets'
import { url } from '../../utils/url-utils'
import { Image } from "astro:assets";
import { url } from "../../utils/url-utils";
const { id, src, alt, position = 'center', basePath = '/' } = Astro.props
const className = Astro.props.class
const { id, src, alt, position = "center", basePath = "/" } = Astro.props;
const className = Astro.props.class;
const isLocal = !(
src.startsWith('/') ||
src.startsWith('http') ||
src.startsWith('https') ||
src.startsWith('data:')
)
const isPublic = src.startsWith('/')
src.startsWith("/") ||
src.startsWith("http") ||
src.startsWith("https") ||
src.startsWith("data:")
);
const isPublic = src.startsWith("/");
// TODO temporary workaround for images dynamic import
// https://github.com/withastro/astro/issues/3373
// biome-ignore lint/suspicious/noImplicitAnyLet: <explanation>
let img
let img;
if (isLocal) {
const files = import.meta.glob<ImageMetadata>('../../**', {
import: 'default',
})
let normalizedPath = path
.normalize(path.join('../../', basePath, src))
.replace(/\\/g, '/')
const file = files[normalizedPath]
if (!file) {
console.error(`\n[ERROR] Image file not found: ${normalizedPath.replace('../../', 'src/')}`)
}
img = await file()
const files = import.meta.glob<ImageMetadata>("../../**", {
import: "default",
});
let normalizedPath = path
.normalize(path.join("../../", basePath, src))
.replace(/\\/g, "/");
const file = files[normalizedPath];
if (!file) {
console.error(
`\n[ERROR] Image file not found: ${normalizedPath.replace("../../", "src/")}`,
);
}
img = await file();
}
const imageClass = 'w-full h-full object-cover'
const imageStyle = `object-position: ${position}`
const imageClass = "w-full h-full object-cover";
const imageStyle = `object-position: ${position}`;
---
<div id={id} class:list={[className, 'overflow-hidden relative']}>
<div class="transition absolute inset-0 dark:bg-black/10 bg-opacity-50 pointer-events-none"></div>