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

FontSizePicker: Hard deprecate bottom margin #58702

Merged
merged 5 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 0 additions & 9 deletions packages/block-editor/src/components/font-sizes/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const MyFontSizePicker = () => {

return (
<FontSizePicker
__nextHasNoMarginBottom
value={ fontSize }
fallbackFontSize={ fallbackFontSize }
onChange={ ( newFontSize ) => {
Expand Down Expand Up @@ -80,11 +79,3 @@ If `true`, the UI will contain a slider, instead of a numeric text input field.
- Type: `Boolean`
- Required: no
- Default: `false`

### __nextHasNoMarginBottom

Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4. (The prop can be safely removed once this happens.)

- Type: `Boolean`
- Required: no
- Default: `false`
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ export default function TypographyPanel( {
withReset={ false }
withSlider
size="__unstable-large"
__nextHasNoMarginBottom
/>
</ToolsPanelItem>
) }
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/hooks/font-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ export function FontSizeEdit( props ) {
withReset={ false }
withSlider
size="__unstable-large"
__nextHasNoMarginBottom
/>
);
}
Expand Down
3 changes: 3 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

### Breaking Changes

- `FontSizePicker`: Remove deprecated `__nextHasNoMarginBottom` prop and promote to default behavior ([#58702](https://github.com/WordPress/gutenberg/pull/58702)).

### Enhancements

Expand Down
8 changes: 0 additions & 8 deletions packages/components/src/font-size-picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const MyFontSizePicker = () => {

return (
<FontSizePicker
__nextHasNoMarginBottom
fontSizes={ fontSizes }
value={ fontSize }
fallbackFontSize={ fallbackFontSize }
Expand Down Expand Up @@ -113,10 +112,3 @@ If `true`, a slider will be displayed alongside the input field when a custom fo

- Required: no
- Default: `false`

### `__nextHasNoMarginBottom`: `boolean`

Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4. (The prop can be safely removed once this happens.)

- Required: no
- Default: `false`
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ import { T_SHIRT_ABBREVIATIONS, T_SHIRT_NAMES } from './constants';
import type { FontSizePickerToggleGroupProps } from './types';

const FontSizePickerToggleGroup = ( props: FontSizePickerToggleGroupProps ) => {
const {
fontSizes,
value,
__nextHasNoMarginBottom,
__next40pxDefaultSize,
size,
onChange,
} = props;
const { fontSizes, value, __next40pxDefaultSize, size, onChange } = props;
return (
<ToggleGroupControl
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
__nextHasNoMarginBottom
__next40pxDefaultSize={ __next40pxDefaultSize }
label={ __( 'Font size' ) }
hideLabelFromVision
Expand Down
24 changes: 3 additions & 21 deletions packages/components/src/font-size-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type { ForwardedRef } from 'react';
/**
* WordPress dependencies
*/
import deprecated from '@wordpress/deprecated';
import { __ } from '@wordpress/i18n';
import { settings } from '@wordpress/icons';
import { useState, useMemo, forwardRef } from '@wordpress/element';
Expand All @@ -31,7 +30,6 @@ import {
HeaderHint,
HeaderLabel,
HeaderToggle,
Controls,
} from './styles';
import { Spacer } from '../spacer';
import FontSizePickerSelect from './font-size-picker-select';
Expand All @@ -43,8 +41,6 @@ const UnforwardedFontSizePicker = (
ref: ForwardedRef< any >
) => {
const {
/** Start opting into the new margin-free styles that will become the default in a future version. */
__nextHasNoMarginBottom = false,
__next40pxDefaultSize = false,
fallbackFontSize,
fontSizes = [],
Expand All @@ -57,14 +53,6 @@ const UnforwardedFontSizePicker = (
withReset = true,
} = props;

if ( ! __nextHasNoMarginBottom ) {
deprecated( 'Bottom margin styles for wp.components.FontSizePicker', {
since: '6.1',
version: '6.4',
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',
} );
}

const units = useCustomUnits( {
availableUnits: unitsProp || [ 'px', 'em', 'rem' ],
} );
Expand Down Expand Up @@ -159,10 +147,7 @@ const UnforwardedFontSizePicker = (
) }
</Header>
</Spacer>
<Controls
className="components-font-size-picker__controls"
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
>
<div>
{ !! fontSizes.length &&
shouldUseSelectControl &&
! showCustomValueControl && (
Expand Down Expand Up @@ -196,7 +181,6 @@ const UnforwardedFontSizePicker = (
<FontSizePickerToggleGroup
fontSizes={ fontSizes }
value={ value }
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
__next40pxDefaultSize={ __next40pxDefaultSize }
size={ size }
onChange={ ( newValue ) => {
Expand Down Expand Up @@ -243,9 +227,7 @@ const UnforwardedFontSizePicker = (
<FlexItem isBlock>
<Spacer marginX={ 2 } marginBottom={ 0 }>
<RangeControl
__nextHasNoMarginBottom={
__nextHasNoMarginBottom
}
__nextHasNoMarginBottom
__next40pxDefaultSize={
__next40pxDefaultSize
}
Expand Down Expand Up @@ -297,7 +279,7 @@ const UnforwardedFontSizePicker = (
) }
</Flex>
) }
</Controls>
</div>
</Container>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const TwoFontSizePickersWithState: StoryFn< typeof FontSizePicker > = ( {
export const Default: StoryFn< typeof FontSizePicker > =
FontSizePickerWithState.bind( {} );
Default.args = {
__nextHasNoMarginBottom: true,
disableCustomFontSizes: false,
fontSizes: [
{
Expand Down
7 changes: 0 additions & 7 deletions packages/components/src/font-size-picker/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,3 @@ export const HeaderLabel = styled( BaseControl.VisualLabel )`
export const HeaderHint = styled.span`
color: ${ COLORS.gray[ 700 ] };
`;

export const Controls = styled.div< {
__nextHasNoMarginBottom: boolean;
} >`
${ ( props ) =>
! props.__nextHasNoMarginBottom && `margin-bottom: ${ space( 6 ) };` }
`;
Loading
Loading