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 { @include isMobile {
max-width: 11rem; max-width: 11rem;
} }
&.color-picker-container--no-top-picks {
display: flex;
justify-content: center;
grid-template-columns: unset;
}
} }
.color-picker__top-picks { .color-picker__top-picks {

View File

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