Skip to content

Commit

Permalink
FontSizePicker: Fix control header spacing (#50855)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored May 26, 2023
1 parent d585d3f commit f54db1a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
### Enhancements

- `Tooltip`: Update background color so tooltip boundaries are more visible in the site editor ([#50792](https://github.com/WordPress/gutenberg/pull/50792)).
- `FontSizePicker`: Tweak the header spacing to be more consistent with other design tools ([#50855](https://github.com/WordPress/gutenberg/pull/50855)).

## 24.0.0 (2023-05-10)

Expand Down
10 changes: 5 additions & 5 deletions packages/components/src/font-size-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { useState, useMemo, forwardRef } from '@wordpress/element';
/**
* Internal dependencies
*/
import Button from '../button';
import RangeControl from '../range-control';
import { Flex, FlexItem } from '../flex';
import {
Expand All @@ -24,12 +23,13 @@ import {
} from '../unit-control';
import { VisuallyHidden } from '../visually-hidden';
import { getCommonSizeUnit } from './utils';
import { HStack } from '../h-stack';
import type { FontSizePickerProps } from './types';
import {
Container,
Header,
HeaderHint,
HeaderLabel,
HeaderToggle,
Controls,
ResetButton,
} from './styles';
Expand Down Expand Up @@ -127,7 +127,7 @@ const UnforwardedFontSizePicker = (
<Container ref={ ref } className="components-font-size-picker">
<VisuallyHidden as="legend">{ __( 'Font size' ) }</VisuallyHidden>
<Spacer>
<HStack className="components-font-size-picker__header">
<Header className="components-font-size-picker__header">
<HeaderLabel
aria-label={ `${ __( 'Size' ) } ${ headerHint || '' }` }
>
Expand All @@ -139,7 +139,7 @@ const UnforwardedFontSizePicker = (
) }
</HeaderLabel>
{ ! disableCustomFontSizes && (
<Button
<HeaderToggle
label={
showCustomValueControl
? __( 'Use size preset' )
Expand All @@ -155,7 +155,7 @@ const UnforwardedFontSizePicker = (
isSmall
/>
) }
</HStack>
</Header>
</Spacer>
<Controls
className="components-font-size-picker__controls"
Expand Down
9 changes: 9 additions & 0 deletions packages/components/src/font-size-picker/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import styled from '@emotion/styled';
*/
import BaseControl from '../base-control';
import Button from '../button';
import { HStack } from '../h-stack';
import { space } from '../ui/utils/space';
import { COLORS } from '../utils';
import type { FontSizePickerProps } from './types';
Expand All @@ -18,6 +19,14 @@ export const Container = styled.fieldset`
padding: 0;
`;

export const Header = styled( HStack )`
height: ${ space( 4 ) };
`;

export const HeaderToggle = styled( Button )`
margin-top: ${ space( -1 ) };
`;

export const HeaderLabel = styled( BaseControl.VisualLabel )`
display: flex;
gap: ${ space( 1 ) };
Expand Down

0 comments on commit f54db1a

Please sign in to comment.