Skip to content
Draft
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -349,6 +366,8 @@ defineOgImageComponent('Default', {
<div v-else-if="fileTree" class="flex flex-1" dir="ltr">
<!-- File tree sidebar - sticky with internal scroll -->
<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"
>
Comment on lines 362 to 370
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Duplicate class attribute causes build failure.

The <aside> element has two class attributes (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 single class attribute.

🐛 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<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"
>
<aside
id="file-tree-sidebar"
v-show="!isSidebarCollapsed"
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"
>
🧰 Tools
🪛 GitHub Actions: chromatic

[error] 368-368: Storybook build failed (plugin vite:vue). RolldownError/SyntaxError: Duplicate attribute.

<CodeFileTree
Expand All @@ -365,6 +384,22 @@ 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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding aria-expanded and aria-controls to this button

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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')"
:aria-expanded="!isSidebarCollapsed"
aria-controls="file-tree-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"
Expand Down
Loading