Skip to content

Commit 3a6e6ad

Browse files
committed
fix: responsiveness at md, lg, xl
1 parent 631f6fb commit 3a6e6ad

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

app/(home)/components/Testimonials.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,27 @@ export function Testimonials() {
6666
DurianPy Ratings
6767
</div>
6868
<div className='relative'>
69-
<button className='z-20 absolute left-8 bottom-1/2 bg-opacity-0' onClick={() => api?.scrollTo(current - 1)}>
70-
<Image src={prevArrowIcon} alt='Prev' className='w-10' />
69+
<button className='z-20 absolute left-0 md:left-8 bottom-1/2 bg-opacity-0' onClick={() => api?.scrollTo(current - 1)}>
70+
<Image src={prevArrowIcon} alt='Prev' className='w-2/3' />
7171
</button>
7272
<CarouselContainer setApi={setApi}
7373
opts={{ loop: true }}
7474
autoplay={false}
7575
autoplayInterval={3000}
76-
className="mx-auto px-24"
76+
className="mx-auto px-[10%]"
7777
>
7878
{/* mx-auto max-w-[1280px] */}
7979
<CarouselContent className='mx-auto py-20'>
8080
{dummyData.map((data, index) => (
81-
<CarouselItem className="relative px-5 flex justify-center lg:basis-1/3" key={index}>
82-
<TestimonialCard name={data.name} date={data.date} comment={data.comment} rate={data.rate} profilePic={data.profilePic} className={current === index ? "scale-110 -mt-8" : ""} />
81+
<CarouselItem className="relative px-[3%] flex justify-center lg:basis-1/3" key={index}>
82+
<TestimonialCard name={data.name} date={data.date} comment={data.comment} rate={data.rate} profilePic={data.profilePic} className={current === index ? "sm:scale-110 sm:-mt-8" : ""} />
8383
</CarouselItem>
8484
))}
8585
</CarouselContent>
8686
<CarouselDots className="z-10 absolute bottom-4 left-1/2 -translate-x-1/2 text-2xl py-4 text" />
8787
</CarouselContainer>
88-
<button className='z-20 absolute right-8 bottom-1/2 bg-opacity-0' onClick={() => api?.scrollTo(current + 1)}>
89-
<Image src={nextArrowIcon} alt='Next' className="w-10" />
88+
<button className='z-20 absolute -right-3 md:right-8 bottom-1/2 bg-opacity-0' onClick={() => api?.scrollTo(current + 1)}>
89+
<Image src={nextArrowIcon} alt='Next' className="w-2/3" />
9090
</button>
9191
</div>
9292
</section>
@@ -101,39 +101,39 @@ const Ratings = ({ rate, className }: { rate: number, className: string }) => {
101101
for (let i = 0; i < 5; i++) {
102102
// If index is greater than the rating, append white star, else yellow star.
103103
if (i >= rate) {
104-
starRate.push(<Image src={whiteStarIcon} alt='yellow star' key={i} className='p-[1px]' />)
104+
starRate.push(<Image src={whiteStarIcon} alt='yellow star' key={i} className='p-1' />)
105105
} else {
106-
starRate.push(<Image src={yellowStarIcon} alt='yellow star' key={i} className='p-[1px]' />)
106+
starRate.push(<Image src={yellowStarIcon} alt='yellow star' key={i} className='p-1' />)
107107
}
108108
}
109109

110110
return (
111-
<div className={cn('flex space-x-3 justify-center', className)}>{starRate}</div>
111+
<div className={cn('flex justify-center', className)}>{starRate}</div>
112112
)
113113
}
114114

115115
const TestimonialCard = ({ name, date, comment, rate, profilePic, className }: testimonial) => {
116116
return (
117-
<div className={cn('transition-all duration-300 ease-in-out', className)}>
117+
<div className={cn('transition-all duration-300 ease-in-out space-y-4', className)}>
118118
{/* SPEECH BUBBLE */}
119-
<div className='relative min-w-[300px]'>
119+
<div className='relative'>
120120
<Image src={testimonialCard} alt='testimonial card' priority={true} />
121-
<Ratings rate={rate} className='absolute top-4 left-1/2 -translate-x-1/2' />
122-
<div className='absolute h-1/2 top-16 px-8 text-white md:text-sm lg:text-base xl:text-lg overflow-hidden text-ellipsis xl:leading-6'>
121+
<Ratings rate={rate} className='absolute top-[5%] left-1/2 -translate-x-1/2' />
122+
<div className='absolute h-1/2 inset-y-1/4 px-[5%] text-white text-xs sm:text-base lg:text-base xl:text-lg overflow-hidden text-ellipsis xl:leading-6'>
123123
{comment}
124124
</div>
125-
<a className="absolute bottom-16 left-0 right-2 text-[#B3B3B3] underline underline-offset-2 decoration-1 bg-gradient-to-t from-medium-dark-green from-35% pt-24 ms-8 pb-2 -mb-2"> Read More</a>
125+
<a className="absolute h-fit pt-[15%] px-[4%] inset-x-1 bottom-1/4 text-[#B3B3B3] underline underline-offset-2 decoration-1 text-xs sm:text-base bg-gradient-to-t from-medium-dark-green from-50%"> Read More</a>
126126
</div>
127127

128128
{/* USER AVATAR & NAME */}
129-
<div className='mt-4 ms-[70px] flex space-x-4 items-center'>
130-
<Avatar className='h-16 w-16'>
129+
<div className='flex space-x-3 px-[17%] items-center'>
130+
<Avatar className='h-full w-full max-h-14 max-w-14 sm:max-h-16 sm:max-w-16'>
131131
<AvatarImage src={profilePic} />
132132
<AvatarFallback>{name[0]}</AvatarFallback>
133133
</Avatar>
134134
<div>
135-
<div className="text-white text-lg">{name}</div>
136-
<div className='text-[#B3B3B3]'>{date}</div>
135+
<div className="text-white text-xs sm:text-base lg:text-base xl:text-lg">{name}</div>
136+
<div className='text-[#B3B3B3] text-xs xl:text-base'>{date}</div>
137137
</div>
138138
</div>
139139
</div>

0 commit comments

Comments
 (0)