Skip to content

Commit

Permalink
fix the default fluid value on the UI based on the global typography …
Browse files Browse the repository at this point in the history
…fluid value (WordPress#64803)

Co-authored-by: matiasbenedetto <mmaattiiaass@git.wordpress.org>
Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
  • Loading branch information
3 people authored and bph committed Aug 31, 2024
1 parent e38bd68 commit d2e463b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ function FontSize() {
'typography.fontSizes'
);

const [ globalFluid ] = useGlobalSetting( 'typography.fluid' );

// Get the font sizes from the origin, default to empty array.
const sizes = fontSizes[ origin ] ?? [];

// Get the font size by slug.
const fontSize = sizes.find( ( size ) => size.slug === slug );

// Whether fluid is true or an object, set it to true, otherwise false.
const isFluid = !! fontSize.fluid ?? false;
// Whether the font size is fluid. If not defined, use the global fluid value of the theme.
const isFluid =
fontSize.fluid !== undefined ? !! fontSize.fluid : globalFluid;

// Whether custom fluid values are used.
const isCustomFluid = typeof fontSize.fluid === 'object';
Expand Down

0 comments on commit d2e463b

Please sign in to comment.