Skip to content

feat(ui): add reusable Breadcrumb component with JSON-LD and ARIA sup… - #245

Merged
SYLVIANNORUKA merged 2 commits into
Hamplard-Hub:mainfrom
Mathew2k-hash:feat/breadcrumb-navigation
Jul 31, 2026
Merged

feat(ui): add reusable Breadcrumb component with JSON-LD and ARIA sup…#245
SYLVIANNORUKA merged 2 commits into
Hamplard-Hub:mainfrom
Mathew2k-hash:feat/breadcrumb-navigation

Conversation

@Mathew2k-hash

Copy link
Copy Markdown
Contributor

feat(ui): Breadcrumb navigation component with JSON-LD and ARIA support

Summary

Adds a reusable Breadcrumb component and integrates it across course detail,
learn, and dashboard sub-pages so users always have clear location context.

Changes

New component — src/components/ui/Breadcrumb.tsx

  • Accepts items: { label: string; href?: string }[]
  • Renders trail with ChevronRight separators — e.g.
    Home / Courses / JavaScript Masterclass
  • Last item is always a plain (current page), never a link
  • wrapper with aria-current="page" on the last

item

  • Schema.org BreadcrumbList JSON-LD injected via
<script type="application/ld+json"> — uses absolute URLs via absoluteUrl() for Rich Results compliance - Mobile truncation: collapses to First › … › Last when trail exceeds 4 items Page integrations | Page | Trail | |---|---| | /courses/[id] | Home › Courses › Course title | | /dashboard/courses/[id] | Dashboard › My Courses › Course title | | /dashboard/courses/[id]/learn | Dashboard › My Courses › Course title › Lesson title | | /dashboard/certificates | Dashboard › Certificates | | /dashboard/profile | Dashboard › Profile | | /dashboard/settings | Dashboard › Settings | Tests — src/components/ui/Breadcrumb.test.tsx 20 tests covering: rendering, link vs plain-text items, ARIA attributes, chevron separators, JSON-LD schema output and absolute URL validation, mobile truncation, and edge cases (empty list, single item). Infra fixes - Fixed vitest.config.ts: replaced broken esbuild.jsx option with @vitejs/plugin-react plugin so .tsx files parse correctly in the test runner - Installed missing devDependencies: vitest, @vitejs/plugin-react, jsdom, mdn-data ## Testing bash npx vitest run src/components/ui/Breadcrumb.test.tsx # 20 passed, 0 failed ## Checklist - [x] Breadcrumb renders all items with separators - [x] Last item is not a link - [x] JSON-LD BreadcrumbList output included - [x] aria-label="Breadcrumb" and aria-current="page" correct - [x] All 20 tests passing closes #116

…port

- Add Breadcrumb component (src/components/ui/Breadcrumb.tsx)
  - Props: items: { label: string; href?: string }[]
  - Renders Home / Courses / Page with ChevronRight separators
  - Last item is a plain <span> with aria-current='page', never a link
  - Wraps in <nav aria-label='Breadcrumb'> for screen reader support
  - Emits Schema.org BreadcrumbList JSON-LD via <script> tag
  - Absolute URLs in JSON-LD via absoluteUrl() from lib/seo
  - Mobile truncation: collapses to [first, ..., last] beyond 4 items

- Integrate Breadcrumb into pages
  - courses/[id]: Home > Courses > course title
  - dashboard/courses/[id]: Dashboard > My Courses > course title
  - dashboard/courses/[id]/learn: Dashboard > My Courses > course > lesson
  - dashboard/certificates: Dashboard > Certificates
  - dashboard/profile: Dashboard > Profile
  - dashboard/settings: Dashboard > Settings

- Add Breadcrumb.test.tsx (20 tests, all passing)
  - Rendering, link rendering, ARIA attributes, separators
  - JSON-LD structure and absolute URL validation
  - Mobile truncation and single-item edge cases

- Fix vitest.config.ts: replace broken esbuild.jsx option with
  @vitejs/plugin-react plugin so TSX files parse correctly
- Install missing devDependencies: vitest, @vitejs/plugin-react,
  jsdom, mdn-data
@drips-wave

drips-wave Bot commented Jul 31, 2026

Copy link
Copy Markdown

@Mathew2k-hash Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@SYLVIANNORUKA
SYLVIANNORUKA merged commit 249fb02 into Hamplard-Hub:main Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Frontend] Component: Build Breadcrumb Navigation Component with JSON-LD

2 participants