Skip to content

Commit

Permalink
Match existing design for BoxControl preset labels
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Dec 12, 2024
1 parent 0b42567 commit 910b4c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/components/src/box-control/input-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ export default function BoxInputControl( {
? getPresetIndexFromValue( mergedValue, presetKey, presets )
: undefined;
const marks = hasPresets
? [ { value: 0, label: __( 'None' ) } ].concat(
? [ { value: 0, label: '', tooltip: __( 'None' ) } ].concat(
presets.map( ( preset, index ) => ( {
value: index + 1,
label: preset.name,
label: '',
tooltip: preset.name ?? preset.slug,
} ) )
)
: [];
Expand Down Expand Up @@ -264,7 +265,7 @@ export default function BoxInputControl( {
.label
}
renderTooltipContent={ ( index ) =>
marks[ ! index ? 0 : index ].label
marks[ ! index ? 0 : index ].tooltip
}
min={ 0 }
max={ marks.length - 1 }
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/box-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type CustomValueUnits = {
export interface Preset {
name: string;
slug: string;
value: string;
value?: string;
}

type UnitControlPassthroughProps = Omit<
Expand Down

0 comments on commit 910b4c8

Please sign in to comment.