style: center images in image-viewer component
might make the actual dialog change height based on the image
This commit is contained in:
parent
febb83a164
commit
b369d1f5c7
2 changed files with 4 additions and 4 deletions
|
|
@ -51,7 +51,7 @@ export default function Carousel({ images, className }: Props) {
|
|||
<div className={`overflow-hidden rounded-xl bg-zinc-300 border-2 border-zinc-300 ${className ?? ""}`} ref={emblaRef}>
|
||||
<div className="flex">
|
||||
{images.map((src, index) => (
|
||||
<div key={index} className="flex-[0_0_100%]">
|
||||
<div key={index} className="flex-shrink-0 w-full">
|
||||
<ImageViewer src={src} alt="mii image" width={480} height={320} className="w-full h-auto aspect-[3/2] object-contain" images={images} />
|
||||
</div>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export default function ImageViewer({ src, alt, width, height, className, images
|
|||
useEffect(() => {
|
||||
if (!emblaApi) return;
|
||||
|
||||
// Keep order of images whilst opening on src
|
||||
// Keep order of images whilst opening at src prop
|
||||
const index = images.indexOf(src);
|
||||
if (index !== -1) {
|
||||
emblaApi.scrollTo(index);
|
||||
|
|
@ -111,8 +111,8 @@ export default function ImageViewer({ src, alt, width, height, className, images
|
|||
) : (
|
||||
<>
|
||||
{images.map((image, index) => (
|
||||
<div key={index} className="flex-[0_0_100%]">
|
||||
<Image src={image} alt={alt} width={576} height={576} className="w-full" />
|
||||
<div key={index} className="flex-shrink-0 w-full">
|
||||
<Image src={image} alt={alt} width={576} height={576} className="w-full h-full object-contain" />
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
|
|
|
|||
Loading…
Reference in a new issue