Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LineHeightControl: Deprecate 36px default size #67850

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const MyLineHeightControl = () => (
<LineHeightControl
value={ lineHeight }
onChange={ onChange }
__next40pxDefaultSize
/>
);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { __experimentalNumberControl as NumberControl } from '@wordpress/components';
import deprecated from '@wordpress/deprecated';

/**
* Internal dependencies
Expand Down Expand Up @@ -89,6 +90,17 @@ const LineHeightControl = ( {
onChange( `${ nextValue }` );
};

if (
! __next40pxDefaultSize &&
( otherProps.size === undefined || otherProps.size === 'default' )
) {
deprecated( `36px default size for wp.blockEditor.LineHeightControl`, {
since: '6.8',
version: '7.1',
hint: 'Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version.',
} );
}

return (
<div className="block-editor-line-height-control">
<NumberControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const Template = ( props ) => {

export const Default = Template.bind( {} );
Default.args = {
__next40pxDefaultSize: true,
__unstableInputWidth: '100px',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ const SPIN = STEP * SPIN_FACTOR;

const ControlledLineHeightControl = () => {
const [ value, setValue ] = useState();
return <LineHeightControl value={ value } onChange={ setValue } />;
return (
<LineHeightControl
value={ value }
onChange={ setValue }
__next40pxDefaultSize
/>
);
};

describe( 'LineHeightControl', () => {
Expand Down
Loading