Skip to content

Commit

Permalink
Add vw and vh units to the custom font size picker (WordPress#60607)
Browse files Browse the repository at this point in the history
Add vw and vh to the list of default units in the font size picker.

Co-authored-by: carolinan <poena@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: geriux <geriux@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: richtabor <richtabor@git.wordpress.org>
  • Loading branch information
9 people authored and patil-vipul committed Jun 17, 2024
1 parent 8be9104 commit 2d32c99
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

### Enhancements

- `FontSizePicker`: Add `vw` and `vh` units to the default units in the font size picker ([#60507]((https://github.com/WordPress/gutenberg/pull/60607)).
- `PaletteEdit`: Use consistent spacing and metrics. ([#61368](https://github.com/WordPress/gutenberg/pull/61368)).
- `FormTokenField`: Hide label when not defined ([#61336](https://github.com/WordPress/gutenberg/pull/61336)).
- `ComboboxControl`: supports disabled items ([#61294](https://github.com/WordPress/gutenberg/pull/61294)).
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

0 comments on commit 2d32c99

Please sign in to comment.