Learner Leaderboard
Gamified leaderboard showing the top 5 ranked learners with scores and badges, switchable across real Weekly, Monthly, and All-time tabs. Clicking a tab swaps which fixed ranking array renders.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge, avatar-initials dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/learner-leaderboard.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/education/education11.tsx instead.
Usage
The file also exports education11Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Education11, education11Demo } from "@/components/blocks/education/education11"; export default function Page() { return <Education11 {...education11Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | ReactNode | "Top learners" | Section heading. |
| description | string | undefined | Supporting copy under the heading. |
| periods | Record<LeaderboardPeriod, LeaderboardEntry[]> | none | One fixed ranking array per period; the active tab selects which array renders. |
| className | string | none | Extra classes for the outer section element. |
Types
type LeaderboardEntry = { rank: number; name: string; score: string; badge?: string; }; type LeaderboardPeriod = "weekly" | "monthly" | "alltime";
Behavior notes
- The period tabs are REAL working client state: a `useState<LeaderboardPeriod>("weekly")` picks which of `periods.weekly` / `periods.monthly` / `periods.alltime` renders, and the active tab is visually highlighted with a solid background. This is genuine interactivity, not decorative.
- Each period's 5-entry array is supplied entirely by the caller via props; the component does no ranking, sorting, or scoring math of its own.
- Avatars use initials only (no photo prop) via the avatar-initials pattern, matched from each entry's `name`.
- Top-3 ranks (1st/2nd/3rd) get a distinct medal-style badge color; this is purely a CSS lookup by rank number, not separate state.
- The demo props live in a separate education11.demo.tsx sibling file (no "use client" directive) since this component is a Client Component - block-layout.tsx's Server Component spreads these props onto the live preview, and a demo object exported from a "use client" module resolves to undefined when spread from server code.
More Education Blocks
View all →academy-course-cards
Academy Course Cards
Academy section with an eyebrow, a two-column heading, and three course cards that float a lesson checklist above a category label, title, and lesson count.
institutional-quick-facts
Institutional Quick Facts
Quick facts grid displaying key institutional statistics with a large value, label, and short description per tile.
global-partnerships-grid
Global Partnerships Grid
Global partnerships section showcasing partner institutions with location details and yearly exchange statistics.
mission-and-vision-statement
Mission and Vision Statement
Side-by-side mission and vision text blocks with an inspirational leadership quote below.
social-media-links-grid
Social Media Links Grid
Social media connection section with platform cards showing handle and follower count.
education-social-proof
Education Social Proof
Social proof section pairing key stats (rating, enrollment, completion rate) with a featured student testimonial.