feat: allow the hiding of top picks

This commit is contained in:
Ryan Di
2025-07-16 11:58:11 +10:00
parent cde46793f8
commit 580622709d
2 changed files with 24 additions and 8 deletions

View File

@@ -22,6 +22,12 @@
@include isMobile {
max-width: 11rem;
}
&.color-picker-container--no-top-picks {
display: flex;
justify-content: center;
grid-template-columns: unset;
}
}
.color-picker__top-picks {

View File

@@ -67,6 +67,7 @@ interface ColorPickerProps {
palette?: ColorPaletteCustom | null;
topPicks?: ColorTuple;
updateData: (formData?: any) => void;
hideTopPicks?: boolean;
}
const ColorPickerPopupContent = ({
@@ -224,17 +225,26 @@ export const ColorPicker = ({
topPicks,
updateData,
appState,
hideTopPicks = false,
}: ColorPickerProps) => {
return (
<div>
<div role="dialog" aria-modal="true" className="color-picker-container">
<TopPicks
activeColor={color}
onChange={onChange}
type={type}
topPicks={topPicks}
/>
<ButtonSeparator />
<div
role="dialog"
aria-modal="true"
className={clsx("color-picker-container", {
"color-picker-container--no-top-picks": hideTopPicks,
})}
>
{!hideTopPicks && (
<TopPicks
activeColor={color}
onChange={onChange}
type={type}
topPicks={topPicks}
/>
)}
{!hideTopPicks && <ButtonSeparator />}
<Popover.Root
open={appState.openPopup === type}
onOpenChange={(open) => {