-
-
Notifications
You must be signed in to change notification settings - Fork 425
feat: add sidebar toggle to package code browser #2352
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
Draft
jfernsio
wants to merge
5
commits into
npmx-dev:main
Choose a base branch
from
jfernsio:add-splitpane-functionality
base: main
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.
+130
−0
Draft
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
60a722b
feat:add splitpane functionality to hide sidebar
jfernsio 4ce9fea
chore(i18n): remove unused keys reported by i18n:report
jfernsio 0aaefd8
Merge branch 'main' into add-splitpane-functionality
jfernsio 3efdba1
fix(sidebar): add ARIA attributes to toggle button
jfernsio 22fee07
Merge branch 'main' into add-splitpane-functionality
jfernsio 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -310,6 +310,23 @@ defineOgImageComponent('Default', { | |
| description: () => pkg.value?.license ?? '', | ||
| primaryColor: '#60a5fa', | ||
| }) | ||
|
|
||
| // Sidebar visibility | ||
| const { settings } = useSettings() | ||
| const isSidebarCollapsed = computed({ | ||
| get: () => settings.value.sidebar.collapsed.includes('code'), | ||
| set: value => { | ||
| const collapsed = settings.value.sidebar.collapsed.filter(id => id !== 'code') | ||
| if (value) { | ||
| collapsed.push('code') | ||
| } | ||
| settings.value.sidebar.collapsed = collapsed | ||
| }, | ||
| }) | ||
|
|
||
| function toggleSidebar() { | ||
| isSidebarCollapsed.value = !isSidebarCollapsed.value | ||
| } | ||
| </script> | ||
|
|
||
| <template> | ||
|
|
@@ -349,6 +366,7 @@ defineOgImageComponent('Default', { | |
| <div v-else-if="fileTree" class="flex flex-1" dir="ltr"> | ||
| <!-- File tree sidebar - sticky with internal scroll --> | ||
| <aside | ||
| v-show="!isSidebarCollapsed" | ||
| class="w-64 lg:w-72 border-ie border-border shrink-0 hidden md:block bg-bg-subtle sticky top-25 self-start h-[calc(100vh-7rem)] overflow-y-auto" | ||
| > | ||
| <CodeFileTree | ||
|
|
@@ -365,6 +383,20 @@ defineOgImageComponent('Default', { | |
| class="sticky z-5 top-25 bg-bg border-b border-border px-4 py-2 flex items-center justify-between gap-2 text-nowrap overflow-x-auto max-w-full" | ||
| > | ||
| <div class="flex items-center gap-2"> | ||
| <!-- Sidebar toggle button --> | ||
| <button | ||
|
Contributor
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. Consider adding
Author
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. sure will add those 👍 |
||
| type="button" | ||
| class="hidden md:flex items-center justify-center w-8 h-8 text-fg-subtle hover:text-fg transition-colors focus-visible:outline-accent/70 rounded" | ||
| :aria-label="$t(isSidebarCollapsed ? 'code.show_sidebar' : 'code.hide_sidebar')" | ||
| @click="toggleSidebar" | ||
| > | ||
| <span | ||
| class="w-4 h-4" | ||
| :class="isSidebarCollapsed ? 'i-lucide:sidebar-open' : 'i-lucide:sidebar-close'" | ||
| aria-hidden="true" | ||
| /> | ||
| </button> | ||
|
|
||
| <div | ||
| v-if="fileContent?.markdownHtml" | ||
| class="flex items-center gap-1 p-0.5 bg-bg-subtle border border-border-subtle rounded-md overflow-x-auto" | ||
|
|
||
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
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.
Duplicate
classattribute causes build failure.The
<aside>element has twoclassattributes (lines 366 and 368), which is invalid HTML and is causing the Storybook/Chromatic build to fail with "Duplicate attribute" error. You need to merge these into a singleclassattribute.🐛 Proposed fix to merge the duplicate class attributes
<aside id="file-tree-sidebar" v-show="!isSidebarCollapsed" - class="w-64 lg:w-72 border-ie border-border shrink-0 hidden md:block bg-bg-subtle sticky top-25 self-start h-[calc(100vh-7rem)] overflow-y-auto" - - class="sticky top-25 w-64 lg:w-72 hidden md:block h-[calc(100vh-10.5rem)] shrink-0 self-start bg-bg-subtle border-ie border-border" - + class="sticky top-25 w-64 lg:w-72 hidden md:block h-[calc(100vh-10.5rem)] shrink-0 self-start bg-bg-subtle border-ie border-border overflow-y-auto" >📝 Committable suggestion
🧰 Tools
🪛 GitHub Actions: chromatic
[error] 368-368: Storybook build failed (plugin vite:vue). RolldownError/SyntaxError: Duplicate attribute.