Skip to content

Commit 5bc9d0d

Browse files
sserrataclaude
andcommitted
fix(palette-picker): mobile-friendly compact button + bottom sheet
On mobile (≤996px): - Trigger collapses to a 36px circular swatch-only button (no text/chevron) that fits cleanly in the navbar top bar - Dropdown becomes a fixed bottom sheet with rounded top corners, a drag handle indicator, and larger touch targets (12px padding per row) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f7d5f65 commit 5bc9d0d

2 files changed

Lines changed: 54 additions & 4 deletions

File tree

demo/src/components/PalettePicker/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,12 @@ export default function PalettePicker({
8787
}
8888

8989
// Hide in mobile nav drawer
90-
if (mobile) return null;
91-
9290
const current = THEMES.find((t) => t.id === active) ?? THEMES[0];
9391

92+
// In the mobile drawer Docusaurus renders a flat list — skip there,
93+
// the top-bar compact button is already accessible on mobile.
94+
if (mobile) return null;
95+
9496
return (
9597
<div ref={containerRef} className={styles.root}>
9698
<button

demo/src/components/PalettePicker/styles.module.css

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,57 @@
103103
color: var(--ifm-color-primary);
104104
}
105105

106-
/* Hide in the mobile top bar — Docusaurus collapses the navbar at 996px */
106+
/* Mobile — collapse to swatch-only button, full-width dropdown */
107107
@media (max-width: 996px) {
108-
.root {
108+
.trigger {
109+
padding: 6px;
110+
width: 36px;
111+
height: 36px;
112+
justify-content: center;
113+
border-radius: 50%;
114+
}
115+
116+
.triggerLabel,
117+
.chevron {
109118
display: none;
110119
}
120+
121+
.swatch {
122+
width: 14px;
123+
height: 14px;
124+
}
125+
126+
.dropdown {
127+
position: fixed;
128+
top: auto;
129+
bottom: 0;
130+
left: 0;
131+
right: 0;
132+
min-width: unset;
133+
width: 100%;
134+
border-radius: 16px 16px 0 0;
135+
padding: 8px 8px 24px;
136+
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.16);
137+
}
138+
139+
/* Sheet handle */
140+
.dropdown::before {
141+
content: "";
142+
display: block;
143+
width: 36px;
144+
height: 4px;
145+
background: var(--ifm-color-emphasis-300);
146+
border-radius: 2px;
147+
margin: 4px auto 12px;
148+
}
149+
150+
.option {
151+
padding: 12px 16px;
152+
font-size: 15px;
153+
}
154+
155+
.swatch {
156+
width: 12px;
157+
height: 12px;
158+
}
111159
}

0 commit comments

Comments
 (0)