From 5868cddcb6656bc5b2882bfba8cd30b7c2d4145f Mon Sep 17 00:00:00 2001 From: Lry722 <91137806+Lry722@users.noreply.github.com> Date: Mon, 10 Jun 2024 02:03:57 +0800 Subject: [PATCH] feat: add option `position` for banner image (#106) --- src/components/misc/ImageWrapper.astro | 11 +++++++---- src/config.ts | 1 + src/types/config.ts | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/misc/ImageWrapper.astro b/src/components/misc/ImageWrapper.astro index 131fd5f..78d12b9 100644 --- a/src/components/misc/ImageWrapper.astro +++ b/src/components/misc/ImageWrapper.astro @@ -5,12 +5,13 @@ interface Props { src: string; class?: string; alt?: string + position?: string; basePath?: string } import { Image } from 'astro:assets'; -import {url} from "../../utils/url-utils"; +import { url } from "../../utils/url-utils"; -const {id, src, alt, basePath = '/'} = Astro.props; +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:')); @@ -25,10 +26,12 @@ if (isLocal) { img = await (files[normalizedPath])(); } +const imageClass = 'w-full h-full object-cover'; +const imageStyle = `object-position: ${position}` ---