mirror of
https://github.com/ershisan99/www.git
synced 2025-12-17 12:34:17 +00:00
add image optimization
This commit is contained in:
14
src/components/optimized-image.tsx
Normal file
14
src/components/optimized-image.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
'use client'
|
||||
|
||||
import { CDN_URL } from '@/shared/constants'
|
||||
import type { ComponentPropsWithoutRef } from 'react'
|
||||
|
||||
export function OptimizedImage(props: ComponentPropsWithoutRef<'img'>) {
|
||||
const isDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
if (isDev) {
|
||||
return <img {...props} />
|
||||
}
|
||||
|
||||
return <img {...props} src={`${CDN_URL}${props.src}`} alt={props.alt} />
|
||||
}
|
||||
Reference in New Issue
Block a user