Datasets:
Download tasks/c03/repo/src/components/BookCarousel.jsx from Roy-DOU/Webdev-Bench: direct link, hf CLI and curl.
- Browser
- Download file 3.78 kB
-
https://huggingface.co/datasets/Roy-DOU/Webdev-Bench/resolve/main/tasks/c03/repo/src/components/BookCarousel.jsx
- Command line
-
hf download hf://datasets/Roy-DOU/Webdev-Bench/tasks/c03/repo/src/components/BookCarousel.jsx
-
curl -L -o BookCarousel.jsx https://huggingface.co/datasets/Roy-DOU/Webdev-Bench/resolve/main/tasks/c03/repo/src/components/BookCarousel.jsx
3.78 kB
| import { useState } from 'react' | |
| import { Chevron } from './Icons.jsx' | |
| const PAGES = [ | |
| { | |
| title: 'Honoring the story of childhood', | |
| image: '/images/book-slide1.jpg', | |
| alt: 'Students dancing together in the school gym', | |
| body: ( | |
| <> | |
| We know the earliest chapters of a child’s life are among the most important and influential.{' '} | |
| <a href="#top" className="text-link">Our PreK-8 model</a> celebrates every formative moment, beginning with | |
| our Early School’s Montessori commitment to independent and impassioned learning. Here, students are | |
| allowed to <a href="#top" className="text-link">be children a little longer</a> and empowered to{' '} | |
| <a href="#top" className="text-link">be leaders a little sooner</a>. Then they graduate confident, | |
| compassionate, and prepared to <a href="#top" className="text-link">go anywhere from here</a>. | |
| </> | |
| ), | |
| }, | |
| { | |
| title: 'A community of storytellers', | |
| image: '/images/gallery1.jpg', | |
| alt: 'Athletes celebrating together after a game', | |
| body: ( | |
| <> | |
| Every Prep student belongs to a close-knit community where teachers, coaches, and classmates cheer each | |
| chapter forward. From <a href="#top" className="text-link">athletics</a> to{' '} | |
| <a href="#top" className="text-link">the arts</a>, our students discover their voices in classrooms and on | |
| stages, courts, and fields. Small classes mean every child is deeply known—and every triumph, large | |
| or small, is <a href="#top" className="text-link">celebrated together</a>. | |
| </> | |
| ), | |
| }, | |
| { | |
| title: 'A campus built for wonder', | |
| image: '/images/gallery2.jpg', | |
| alt: 'Aerial view of the Charlotte Prep campus in autumn', | |
| body: ( | |
| <> | |
| Tucked into a wooded corner of Charlotte, our campus invites exploration at every turn. Light-filled | |
| classrooms, <a href="#top" className="text-link">modern learning spaces</a>, gardens, and play areas give | |
| students room to imagine, build, and grow. It is a place designed for{' '} | |
| <a href="#top" className="text-link">hands-on discovery</a>—where every corner holds the beginning | |
| of a <a href="#top" className="text-link">new story</a>. | |
| </> | |
| ), | |
| }, | |
| ] | |
| export default function BookCarousel() { | |
| const [index, setIndex] = useState(0) | |
| const page = PAGES[index] | |
| const step = (dir) => setIndex((i) => (i + dir + PAGES.length) % PAGES.length) | |
| return ( | |
| <section className="book-section"> | |
| <button className="book-arrow book-arrow-left" onClick={() => step(-1)} aria-label="Previous page"> | |
| <Chevron dir="left" size={30} color="#2c2c2c" strokeWidth={1.8} /> | |
| </button> | |
| <div className="book-wrap"> | |
| <article className="book-card"> | |
| <span className="book-border" aria-hidden="true" /> | |
| <div className="book-photo"> | |
| <img src={page.image} alt={page.alt} /> | |
| </div> | |
| <div className="book-text"> | |
| <h2>{page.title}</h2> | |
| <p>{page.body}</p> | |
| </div> | |
| </article> | |
| <div className="book-dots" role="tablist" aria-label="Book pages"> | |
| {PAGES.map((p, i) => ( | |
| <button | |
| key={p.title} | |
| role="tab" | |
| aria-selected={i === index} | |
| aria-label={`Go to page ${i + 1}`} | |
| className={`book-dot${i === index ? ' is-active' : ''}`} | |
| onClick={() => setIndex(i)} | |
| /> | |
| ))} | |
| </div> | |
| </div> | |
| <button className="book-arrow book-arrow-right" onClick={() => step(1)} aria-label="Next page"> | |
| <Chevron dir="right" size={30} color="#2c2c2c" strokeWidth={1.8} /> | |
| </button> | |
| </section> | |
| ) | |
| } | |