Skip to content

Commit

Permalink
style font family option
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenedetto committed Nov 19, 2024
1 parent 180211c commit d49960c
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions packages/block-editor/src/components/font-family/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,20 @@ export default function FontFamilyControl( {
return null;
}

const options = [
{ value: '', label: __( 'Default' ) },
...fontFamilies.map( ( { fontFamily, name } ) => {
return {
value: fontFamily,
label: name || fontFamily,
};
} ),
];
const options = (
<>
<option value="">{ __( 'Default' ) }</option>
{ fontFamilies.map( ( { fontFamily, name, slug } ) => (
<option
key={ slug }
value={ fontFamily }
style={ { fontFamily } }
>
{ name || fontFamily }
</option>
) ) }
</>
);

if ( ! __nextHasNoMarginBottom ) {
deprecated(
Expand All @@ -55,11 +60,12 @@ export default function FontFamilyControl( {
__next40pxDefaultSize={ __next40pxDefaultSize }
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
label={ __( 'Font' ) }
options={ options }
value={ value }
onChange={ onChange }
labelPosition="top"
{ ...props }
/>
>
{ options }
</SelectControl>
);
}

0 comments on commit d49960c

Please sign in to comment.