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

Add vw and vh units to the custom font size picker #60607

Merged
merged 9 commits into from
May 23, 2024
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

### Enhancements

- `FontSizePicker`: Add `vw` and `vh` units to the font size picker ([#60507]((https://github.com/WordPress/gutenberg/pull/60607)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, if you were to ship this PR as is, you would need to move the entry to the "Enhancements" section within the "Unreleased" section.

- `Tooltip`: Make tests faster ([#60897](https://github.com/WordPress/gutenberg/pull/60897)).
- `ExternalLink`: Use unicode arrow instead of svg icon ([#60255](https://github.com/WordPress/gutenberg/pull/60255)).
- `ProgressBar`: Move the indicator width styles from emotion to a CSS variable ([#60388](https://github.com/WordPress/gutenberg/pull/60388)).
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/font-size-picker/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function FontSizePicker( {
const label = __( 'Font Size' );

const units = useCustomUnits( {
availableUnits: [ 'px', 'em', 'rem' ],
availableUnits: [ 'px', 'em', 'rem', 'vw', 'vh' ],
} );

const accessibilityLabel = sprintf(
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/font-size-picker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import FontSizePickerSelect from './font-size-picker-select';
import FontSizePickerToggleGroup from './font-size-picker-toggle-group';
import { T_SHIRT_NAMES } from './constants';

const DEFAULT_UNITS = [ 'px', 'em', 'rem' ];
const DEFAULT_UNITS = [ 'px', 'em', 'rem', 'vw', 'vh' ];

const UnforwardedFontSizePicker = (
props: FontSizePickerProps,
Expand Down Expand Up @@ -112,7 +112,7 @@ const UnforwardedFontSizePicker = (
units
);
const isValueUnitRelative =
!! valueUnit && [ 'em', 'rem' ].includes( valueUnit );
!! valueUnit && [ 'em', 'rem', 'vw', 'vh' ].includes( valueUnit );
const isDisabled = value === undefined;

return (
Expand Down
Loading