diff --git a/src/components/ui/ImageOptimizer.astro b/src/components/ui/ImageOptimizer.astro index a98e625..5c29c9b 100644 --- a/src/components/ui/ImageOptimizer.astro +++ b/src/components/ui/ImageOptimizer.astro @@ -1,100 +1,20 @@ ---- -import { Image } from 'astro:assets' -import type { ImageOptimizerProps } from '../../types/component.types' - -const { - src, - alt, - width, - height, - quality = 85, - format = 'webp', - loading = 'lazy', - decoding = 'async', - class: className, - caption, - priority = false -} = Astro.props as ImageOptimizerProps - -// Use eager loading for priority images -const actualLoading = priority ? 'eager' : loading - -// Generate responsive image sizes -const sizes = '(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw' ---- - -
- { - typeof src === 'string' ? ( - {alt} - ) : ( - {alt} - ) + diff --git a/src/layouts/PostLayout.astro b/src/layouts/PostLayout.astro index 7851259..301ba97 100644 --- a/src/layouts/PostLayout.astro +++ b/src/layouts/PostLayout.astro @@ -10,6 +10,7 @@ import TableOfContents from '@/components/ui/TableOfContents.astro' import GradientMask from '@/components/ui/GradientMask.astro' import ImageViewer from '@/components/ui/ImageViewer.astro' import GitHubCard from '@/components/ui/GitHubCard.astro' +import ImageOptimizer from '@/components/ui/ImageOptimizer.astro' import XPOST from '@/components/ui/XPOST.astro' import CopyCode from '@/components/ui/CopyCode.astro' import BaseLayout from '@/layouts/BaseLayout.astro' @@ -60,6 +61,7 @@ const ogImage = `/open-graph/${postSlug}.png` + {themeConfig.post.imageViewer && } {themeConfig.general.footer &&