StealThis .dev

Gym — Class Detail

A bold, athletic class detail card for a single gym session. Shows a hero strip with the class name and intensity badge, trainer avatar and rating, schedule, studio, an estimated calorie burn, a difficulty meter, a what-to-bring checklist, a live spots progress bar with a roster preview of attendees, and a prominent Book CTA. Booking updates the bar and roster, while a full class flips the button into a waitlist flow with toast feedback.

在 Lab 中打开
html css vanilla-js
目标: JS HTML

代码

Class Detail

A self-contained, dark-themed class detail panel for a boutique gym, built for the “book a class” moment. The hero strip leads with the class name (HIIT Burn 45), a pulsing high-intensity badge and a one-line pitch, then hands off to the coach block with avatar, rating and a Follow toggle. A four-cell meta grid covers day and time, duration, studio and estimated calorie burn, followed by a five-bar difficulty meter, a what-to-bring checklist and an availability section.

The availability section is the interactive core: a live progress bar tracks 14/20 booked, with a hint line that warns when spots are running low. Pressing Book this class increments the count, animates the bar, drops a “ME” avatar into the roster preview and confirms with a toast. The button then becomes a Cancel state that reverses everything. When the class is full the CTA switches to a Join waitlist flow, and the progress bar shifts to a hot orange-to-red fill to signal the sell-out.

Everything is vanilla HTML, CSS and JavaScript — no frameworks or build step. State is held in a small object and re-rendered on each action, a reusable toast() helper handles feedback, and the layout is responsive down to ~360px (collapsing to a full-screen sheet on phones). The card uses ARIA roles on the progress bar and buttons, keyboard-usable controls, visible focus rings and a reduced-motion fallback.