-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b204bfb
commit 0b5b104
Showing
2 changed files
with
99 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use client' | ||
|
||
import { useState } from 'react' | ||
import { Button } from './Button' | ||
import { Testimonial, TestimonialItem } from './Testimonials' | ||
|
||
function TestimonialForSmallScreen({ testimonials }: { testimonials: TestimonialItem[][][] }) { | ||
const [showAll, setShowAll] = useState(false) | ||
|
||
const allTestimonials = testimonials.flatMap((columnGroup) => | ||
columnGroup.flatMap((column) => column) | ||
) | ||
const testimonialsToShow = showAll ? allTestimonials : allTestimonials.slice(0, 4) | ||
return ( | ||
<div className="visible col-span-2 flex flex-col gap-y-4 xl:hidden"> | ||
{testimonialsToShow.map((testimonial, i) => ( | ||
<Testimonial key={i} testimonial={testimonial} columnIdx={i} columnGroupIdx={0} /> | ||
))} | ||
{!showAll && <Button onClick={() => setShowAll(!showAll)}>Load More</Button>} | ||
</div> | ||
) | ||
} | ||
|
||
export default TestimonialForSmallScreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters