Files
haiyushuke-website/src/components/news-cover-image.tsx

29 lines
532 B
TypeScript
Raw Normal View History

2026-06-16 14:34:09 +08:00
import Image from "next/image";
type NewsCoverImageProps = {
src: string;
alt: string;
priority?: boolean;
className?: string;
sizes?: string;
};
export function NewsCoverImage({
src,
alt,
priority = false,
className = "",
sizes = "(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 640px",
}: NewsCoverImageProps) {
return (
<Image
src={src}
alt={alt}
fill
sizes={sizes}
className={`object-cover object-center ${className}`.trim()}
priority={priority}
/>
);
}