website/app/components/Photo.tsx

58 lines
1.9 KiB
TypeScript
Raw Normal View History

2023-12-03 23:02:09 +07:00
"use client"
import Image from 'next/image';
import Link from 'next/link';
import React from "react";
2023-12-23 11:21:03 +07:00
const Photo = ({src, href, alt}: any) => {
2023-12-21 20:40:11 +07:00
let classes = "transition ease-in-out delay-150 hover:scale-105 duration-300";
2023-12-03 23:02:09 +07:00
if(!href || href == "#") {
return (
<div>
<div className="grid content-center">
<div className={classes}>
<Image
2024-05-03 10:41:57 +07:00
className="h-auto max-w-full rounded-xl"
2023-12-03 23:02:09 +07:00
src={src}
width={0}
height={0}
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
alt={alt}
/>
<span className="text-xs m-2 text-zinc-600 dark:text-zinc-400">{alt}</span>
2023-12-03 23:02:09 +07:00
</div>
</div>
</div>
)
} else {
return (
<div>
<Link
href={href}
>
<div className="grid content-center">
<div className={classes}>
<Image
2024-05-03 10:41:57 +07:00
className="h-auto max-w-full rounded-xl"
2023-12-03 23:02:09 +07:00
src={src}
width={0}
height={0}
sizes="100vw"
style={{ width: '100%', height: 'auto' }}
alt={alt}
/>
<span className="text-xs m-2 text-zinc-600 dark:text-zinc-400">{alt}</span>
2023-12-03 23:02:09 +07:00
</div>
</div>
</Link>
</div>
)
}
}
export default Photo;