-
Notifications
You must be signed in to change notification settings - Fork 0
feat: build modular element detail page #64
Open
ronjalh
wants to merge
5
commits into
48-element-variant-card
Choose a base branch
from
63-element-detail-page
base: 48-element-variant-card
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+660
−143
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fb142ce
feat: add catalog lookup for element details
3c1c370
fix: reuse difficulty badge in element variants
9f23af7
feat: build modular element detail page
419666f
fix: use existing light text token for actions
1d8a98e
fix: format with Prettier, copy images to dist and drop role=img from…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,40 @@ | ||
| import { useState } from 'react' | ||
| import { LockKeyhole, Plus } from 'lucide-react' | ||
| import { Button } from '@/components/ui/button' | ||
| import type { ElementDetail } from '@/lib/catalog' | ||
|
|
||
| export default function ElementActions({ | ||
| element, | ||
| }: { | ||
| element: ElementDetail | ||
| }) { | ||
| const [status, setStatus] = useState('') | ||
|
|
||
| return ( | ||
| <div | ||
| data-element-id={element.id} | ||
| className="flex flex-wrap items-center gap-3 text-left" | ||
| > | ||
| <Button | ||
| type="button" | ||
| variant="outline" | ||
| className="h-10 rounded-full bg-(--primary-color) px-5 font-heading text-(--text-color-dark)" | ||
| onClick={() => setStatus('The routine builder is not connected yet.')} | ||
| > | ||
| Try in a routine | ||
| <Plus aria-hidden="true" /> | ||
| </Button> | ||
| <Button | ||
| type="button" | ||
| className="h-10 rounded-full border border-(--box-stroke) bg-(--text-color-dark) px-5 font-heading text-(--text-color-light) hover:bg-(--text-color-dark)" | ||
| onClick={() => setStatus('Sign-in is not connected yet.')} | ||
| > | ||
| Add to gymnast | ||
| <LockKeyhole aria-hidden="true" /> | ||
| </Button> | ||
| <p className="sr-only" aria-live="polite" aria-atomic="true"> | ||
| {status} | ||
| </p> | ||
| </div> | ||
| ) | ||
| } |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking good! Two quick accessibility improvements before merging:
|
This file contains hidden or 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,38 @@ | ||
| import { ArrowLeft } from 'lucide-react' | ||
| import { useNavigate } from 'react-router-dom' | ||
| import type { ElementDetail } from '@/lib/catalog' | ||
|
|
||
| export default function ElementDetailHeader({ | ||
| element, | ||
| }: { | ||
| element: ElementDetail | ||
| }) { | ||
| const navigate = useNavigate() | ||
|
|
||
| return ( | ||
| <header className="space-y-3 text-left"> | ||
| <button | ||
| type="button" | ||
| onClick={() => navigate(-1)} | ||
| className="inline-flex items-center gap-2 rounded-md py-2 text-sm font-medium text-(--text-color-dark) underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring" | ||
| > | ||
| <ArrowLeft aria-hidden="true" className="size-4" /> | ||
| Back | ||
| </button> | ||
| <div> | ||
| <h1 className="m-0 text-left text-4xl font-bold leading-tight text-(--text-color-dark)"> | ||
| {element.code} | ||
| {element.name && ( | ||
| <> | ||
| <span aria-hidden="true"> · </span> | ||
| {element.name} | ||
| </> | ||
| )} | ||
| </h1> | ||
| <p className="mt-2 text-left text-base leading-relaxed text-(--text-color-dark)"> | ||
| {element.description} | ||
| </p> | ||
| </div> | ||
| </header> | ||
| ) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work setting up the
aria-liveregion for screen readers!Two quick fixes before merging:
p.sr-onlyhides the status text from sight, leaving sighted users with no feedback when clicking the buttons. Render the status message visually (e.g.<p role="status" className="text-xs text-muted-foreground">) so everyone sees why the feature is locked/unbuilt.size-4to<Plus />and<LockKeyhole />to prevent SVG scaling layout glitches across different browsers.