mirror of
https://github.com/simstudioai/sim.git
synced 2026-10-24 23:06:59 +08: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
58 lines
1.2 KiB
TypeScript
58 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import { useState } from 'react'
|
|
import { getAssetUrl } from '@/lib/utils'
|
|
import { Lightbox } from './lightbox'
|
|
|
|
interface VideoProps {
|
|
src: string
|
|
className?: string
|
|
autoPlay?: boolean
|
|
loop?: boolean
|
|
muted?: boolean
|
|
playsInline?: boolean
|
|
enableLightbox?: boolean
|
|
}
|
|
|
|
export function Video({
|
|
src,
|
|
className = 'w-full rounded-xl border border-border overflow-hidden outline-none focus:outline-none',
|
|
autoPlay = true,
|
|
loop = true,
|
|
muted = true,
|
|
playsInline = true,
|
|
enableLightbox = true,
|
|
}: VideoProps) {
|
|
const [isLightboxOpen, setIsLightboxOpen] = useState(false)
|
|
|
|
const handleVideoClick = () => {
|
|
if (enableLightbox) {
|
|
setIsLightboxOpen(true)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<video
|
|
autoPlay={autoPlay}
|
|
loop={loop}
|
|
muted={muted}
|
|
playsInline={playsInline}
|
|
className={`${className} ${enableLightbox ? 'cursor-pointer transition-opacity hover:opacity-95' : ''}`}
|
|
src={getAssetUrl(src)}
|
|
onClick={handleVideoClick}
|
|
/>
|
|
|
|
{enableLightbox && (
|
|
<Lightbox
|
|
isOpen={isLightboxOpen}
|
|
onClose={() => setIsLightboxOpen(false)}
|
|
src={src}
|
|
alt={`Video: ${src}`}
|
|
type='video'
|
|
/>
|
|
)}
|
|
</>
|
|
)
|
|
}
|