mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
* improvement(landing, blog): SEO and GEO optimization * improvement(docs): ui/ux cleanup * chore(blog): remove unused buildBlogJsonLd export and wordCount schema field * fix(blog): stack related posts vertically on mobile and fill all suggestion slots - Add flex-col sm:flex-row and matching border classes to related posts nav for consistent mobile stacking with the main blog page - Remove score > 0 filter in getRelatedPosts so it falls back to recent posts when there aren't enough tag matches - Align description text color with main page cards
54 lines
1.2 KiB
TypeScript
54 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import NextImage, { type ImageProps as NextImageProps } from 'next/image'
|
|
import { Lightbox } from '@/components/ui/lightbox'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
interface ImageProps extends Omit<NextImageProps, 'className'> {
|
|
className?: string
|
|
enableLightbox?: boolean
|
|
}
|
|
|
|
export function Image({
|
|
className = 'w-full',
|
|
enableLightbox = true,
|
|
alt = '',
|
|
src,
|
|
...props
|
|
}: ImageProps) {
|
|
const [isLightboxOpen, setIsLightboxOpen] = useState(false)
|
|
|
|
const handleImageClick = () => {
|
|
if (enableLightbox) {
|
|
setIsLightboxOpen(true)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<NextImage
|
|
className={cn(
|
|
'overflow-hidden rounded-xl border border-border object-cover',
|
|
enableLightbox && 'cursor-pointer transition-opacity hover:opacity-95',
|
|
className
|
|
)}
|
|
alt={alt}
|
|
src={src}
|
|
onClick={handleImageClick}
|
|
{...props}
|
|
/>
|
|
|
|
{enableLightbox && (
|
|
<Lightbox
|
|
isOpen={isLightboxOpen}
|
|
onClose={() => setIsLightboxOpen(false)}
|
|
src={typeof src === 'string' ? src : String(src)}
|
|
alt={alt}
|
|
type='image'
|
|
/>
|
|
)}
|
|
</>
|
|
)
|
|
}
|