-
Notifications
You must be signed in to change notification settings - Fork 1
Add configurable studio sidebar navigation #407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
jackgranatowski
wants to merge
1
commit into
main
from
codex/refactor-nawigacje-w-studioframe.svelte
Closed
Changes from all commits
Commits
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
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
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
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 |
|---|---|---|
| @@ -1,20 +1,66 @@ | ||
| <script> | ||
| import { overrides, ui } from '../../lib/store.svelte.js'; | ||
| import { buildPreviewDeclarations } from '../../lib/preview.js'; | ||
| let { title, eyebrow = 'Studio', description = '', tone = 'primary', children } = $props(); | ||
| let { | ||
| title, | ||
| eyebrow = 'Studio', | ||
| description = '', | ||
| tone = 'primary', | ||
| nav = [], | ||
| activePanel, | ||
| onSelectPanel, | ||
| sidebar, | ||
| children, | ||
| } = $props(); | ||
| let internalActivePanel = $state(); | ||
| const panelNav = $derived(nav.map((item) => (typeof item === 'string' ? { id: item, label: item } : item))); | ||
| const frameSlug = $derived(String(title).replace(/[^a-zA-Z0-9_-]/g, '-').toLowerCase()); | ||
| const firstPanel = $derived(panelNav[0]?.id); | ||
| const selectedPanel = $derived(activePanel ?? internalActivePanel ?? firstPanel); | ||
| const selectedPanelSlug = $derived(selectedPanel ? String(selectedPanel).replace(/[^a-zA-Z0-9_-]/g, '-').toLowerCase() : undefined); | ||
| const panelId = $derived(selectedPanelSlug ? `studio-panel-${frameSlug}-${selectedPanelSlug}` : undefined); | ||
| const stageStyle = $derived(buildPreviewDeclarations(overrides, ui.previewTheme)); | ||
|
|
||
| function selectPanel(panel) { | ||
| internalActivePanel = panel.id; | ||
| onSelectPanel?.(panel.id, panel); | ||
| } | ||
|
|
||
| function getPanelSlug(panel) { | ||
| return String(panel.id).replace(/[^a-zA-Z0-9_-]/g, '-').toLowerCase(); | ||
| } | ||
| </script> | ||
|
|
||
| <section class="studio studio--{tone}" style={stageStyle}> | ||
| <div class="studio__copy"> | ||
| <p>{eyebrow}</p> | ||
| <h3>{title}</h3> | ||
| {#if description}<span>{description}</span>{/if} | ||
| <ol class="studio__steps" aria-label="Studio workflow"> | ||
| <li>01 Preview</li><li>02 Tune</li><li>03 Verify</li> | ||
| </ol> | ||
| {#if sidebar} | ||
| {@render sidebar?.({ activePanel: selectedPanel, panelId })} | ||
| {:else if panelNav.length} | ||
| <nav class="studio__nav" aria-label={`${title} sections`}> | ||
| <div class="studio__tabs" role="tablist" aria-orientation="vertical" aria-label={`${title} sections`}> | ||
| {#each panelNav as panel, index (panel.id)} | ||
| <button | ||
| type="button" | ||
| role="tab" | ||
| class:active={selectedPanel === panel.id} | ||
| aria-selected={selectedPanel === panel.id} | ||
| aria-controls={panel.panelId ?? `studio-panel-${frameSlug}-${getPanelSlug(panel)}`} | ||
| id={`studio-tab-${frameSlug}-${getPanelSlug(panel)}`} | ||
| tabindex={selectedPanel === panel.id ? 0 : -1} | ||
| onclick={() => selectPanel(panel)} | ||
| > | ||
| <b>{String(index + 1).padStart(2, '0')}</b> | ||
| <span>{panel.label}</span> | ||
| </button> | ||
| {/each} | ||
| </div> | ||
| </nav> | ||
| {/if} | ||
| </div> | ||
| <div class="studio__surface">{@render children?.()}</div> | ||
| <div class="studio__surface" role="tabpanel" id={panelId} aria-labelledby={selectedPanelSlug ? `studio-tab-${frameSlug}-${selectedPanelSlug}` : undefined}>{@render children?.()}</div> | ||
|
Comment on lines
+16
to
+63
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. 1. Tabs reference missing panels StudioFrame sets each tab’s aria-controls to a panel-specific id, but only renders a single tabpanel whose id changes with the currently selected panel, so non-selected tabs point to elements that don’t exist in the DOM. If a nav item provides panelId, aria-controls can also diverge because the rendered tabpanel id is not derived from panel.panelId. Agent Prompt
|
||
| </section> | ||
|
|
||
| <style> | ||
|
|
@@ -23,14 +69,18 @@ | |
| .studio__copy p { margin: 0; color: var(--cfg-accent); font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; } | ||
| .studio__copy h3 { margin: 0; font-size: clamp(22px, 3vw, 30px); line-height: 1.02; letter-spacing: -.03em; } | ||
| .studio__copy span { display: block; color: var(--cfg-text-muted); font-size: 13px; line-height: 1.45; } | ||
| .studio__steps { display: grid; gap: 6px; margin-top: 6px; list-style: none; padding: 0; } | ||
| .studio__steps li { padding: 7px 9px; border: 1px solid var(--cfg-border); border-radius: 999px; background: var(--cfg-bg-2); color: var(--cfg-text-muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; } | ||
| .studio__nav { margin-top: 6px; } | ||
| .studio__tabs { display: grid; gap: 6px; } | ||
| .studio__tabs button { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; border: 1px solid var(--cfg-border); border-radius: 999px; background: var(--cfg-bg-2); color: var(--cfg-text-muted); text-align: start; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; cursor: pointer; } | ||
| .studio__tabs button.active { border-color: color-mix(in oklab, var(--cfg-accent) 50%, var(--cfg-border)); background: var(--cfg-accent-soft); color: var(--cfg-text); } | ||
| .studio__tabs b { color: var(--cfg-accent); } | ||
| .studio__surface { min-width: 0; } | ||
| @media (max-width: 820px) { | ||
| .studio { grid-template-columns: 1fr; padding: 12px; } | ||
| .studio__copy { position: static; } | ||
| .studio__copy h3 { font-size: clamp(18px, 4vw, 26px); } | ||
| .studio__copy span { display: none; } | ||
| .studio__steps { grid-template-columns: repeat(3, 1fr); } | ||
| .studio__tabs { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); } | ||
| .studio__tabs { overflow-x: auto; padding-bottom: 4px; } | ||
| } | ||
| </style> | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
2. Invalid activepanel breaks focus
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools