Skip to content

Commit

Permalink
Use in operator to check if the deprecated unit prop is passed to…
Browse files Browse the repository at this point in the history
… `UnitControl`
  • Loading branch information
ciampo committed Mar 18, 2022
1 parent 5b6be2d commit d75a6be
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/components/src/unit-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ import type { UnitControlProps, UnitControlOnChangeCallback } from './types';
import type { StateReducer } from '../input-control/reducer/state';

function UnforwardedUnitControl(
{
unitControlProps: WordPressComponentProps<
UnitControlProps,
'input',
false
>,
forwardedRef: ForwardedRef< any >
) {
const {
__unstableStateReducer: stateReducerProp,
autoComplete = 'off',
className,
Expand All @@ -54,10 +61,9 @@ function UnforwardedUnitControl(
units: unitsProp = CSS_UNITS,
value: valueProp,
...props
}: WordPressComponentProps< UnitControlProps, 'input', false >,
forwardedRef: ForwardedRef< any >
) {
if ( typeof unitProp !== 'undefined' ) {
} = unitControlProps;

if ( 'unit' in unitControlProps ) {
deprecated( 'UnitControl unit prop', {
since: '5.6',
hint: 'The unit should be provided within the `value` prop.',
Expand Down

0 comments on commit d75a6be

Please sign in to comment.