styles: fix product detail img

This commit is contained in:
lytrankieio123
2021-09-13 12:07:55 +07:00
parent 46233a1108
commit 829aeaa847
4 changed files with 42 additions and 4 deletions

View File

@@ -0,0 +1,8 @@
.productImgItem {
@apply w-full h-full;
min-height: 30rem;
img {
object-fit: contain;
}
}

View File

@@ -0,0 +1,19 @@
import React from 'react'
import { ImgWithLink } from 'src/components/common'
import s from './ProductImgItem.module.scss'
export interface ProductImgItemProps {
src: string
alt?: string
}
const ProductImgItem = ({ src, alt }: ProductImgItemProps) => {
return (
<section className={s.productImgItem}>
<ImgWithLink src={src} alt={alt} />
</section >
)
}
export default ProductImgItem

View File

@@ -6,4 +6,7 @@
@screen lg { @screen lg {
max-width: 60rem; max-width: 60rem;
} }
> div {
width: 100%;
}
} }

View File

@@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import { CarouselCommon, ImgWithLink } from 'src/components/common' import { CarouselCommon } from 'src/components/common'
import { ImgWithLinkProps } from 'src/components/common/ImgWithLink/ImgWithLink' import ProductImgItem, { ProductImgItemProps } from '../ProductImgItem/ProductImgItem'
import s from './ProductImgs.module.scss' import s from './ProductImgs.module.scss'
interface Props { interface Props {
@@ -9,6 +9,10 @@ interface Props {
} }
const DATA = [ const DATA = [
{
src: 'https://user-images.githubusercontent.com/76729908/133026929-199799fc-bd75-4445-a24d-15c0e41796eb.png',
alt: 'Meat',
},
{ {
src: 'https://user-images.githubusercontent.com/76729908/130574371-3b75fa72-9552-4605-aba9-a4b31cd9dce7.png', src: 'https://user-images.githubusercontent.com/76729908/130574371-3b75fa72-9552-4605-aba9-a4b31cd9dce7.png',
alt: 'Broccoli', alt: 'Broccoli',
@@ -21,15 +25,18 @@ const DATA = [
const option = { const option = {
slidesPerView: 1, slidesPerView: 1,
// mode: "free",
} }
const ProductImgs = ({ }: Props) => { const ProductImgs = ({ }: Props) => {
return ( return (
<section className={s.productImgs}> <section className={s.productImgs}>
<CarouselCommon<ImgWithLinkProps> <CarouselCommon<ProductImgItemProps>
data={DATA} data={DATA}
itemKey="product-detail-img" itemKey="product-detail-img"
Component={ImgWithLink} Component={ProductImgItem}
option={option} option={option}
isDot={true} isDot={true}
/> />
@@ -38,3 +45,4 @@ const ProductImgs = ({ }: Props) => {
} }
export default ProductImgs export default ProductImgs