Skip to content

Commit 0cc23c8

Browse files
authored
fix(docs): balance the example theme picker (#42859)
The fixed example theme picker leaves space for a chevron that its icon set does not include. The menu also opens toward the viewport edge. Use a square icon button in examples and open its menu above the button. Keep the full theme picker in the documentation navigation.
1 parent fdd6399 commit 0cc23c8

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

site/src/layouts/partials/ThemeToggler.astro

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@ const { layout } = Astro.props
99
---
1010

1111
<button
12-
class=`btn ${layout === 'examples' ? 'btn-solid theme-accent' : 'btn-link nav-link'} px-1 gap-1`
12+
class:list={['btn', layout === 'examples' ? 'btn-solid btn-icon theme-accent' : 'btn-link nav-link px-1 gap-1']}
1313
id="bd-theme"
1414
type="button"
1515
aria-expanded="false"
1616
data-bs-toggle="menu"
17-
data-bs-placement="bottom-end"
17+
data-bs-placement={layout === 'examples' ? 'top-end' : 'bottom-end'}
1818
aria-label="Toggle theme (auto)"
1919
>
2020
<svg class="bi theme-icon-active" aria-hidden="true"><use href="#circle-half"></use></svg>
2121
<span class="visually-hidden">Toggle theme</span>
22-
<svg class="bi bi-sm" aria-hidden="true"><use href="#chevron-expand"></use></svg>
22+
{
23+
layout !== 'examples' && (
24+
<svg class="bi bi-sm" aria-hidden="true">
25+
<use href="#chevron-expand" />
26+
</svg>
27+
)
28+
}
2329
</button>
2430
<div class="menu border-keyline" id="bd-theme-menu" aria-labelledby="bd-theme" style="--bs-menu-min-width: 8rem;">
2531
<button type="button" class="menu-item" data-bs-theme-value="light" aria-pressed="false">

0 commit comments

Comments
 (0)