Skip to content

Global Styles: Upsize typography panel components #42718

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

Merged
merged 2 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default function FontAppearanceControl( props ) {
hasFontStyles = true,
hasFontWeights = true,
value: { fontStyle, fontWeight },
...otherProps
} = props;
const hasStylesOrWeights = hasFontStyles || hasFontWeights;
const label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );
Expand Down Expand Up @@ -205,6 +206,7 @@ export default function FontAppearanceControl( props ) {
return (
hasStylesOrWeights && (
<CustomSelectControl
{ ...otherProps }
className="components-font-appearance-control"
label={ label }
describedBy={ getDescribedBy() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ export default function LetterSpacingControl( {
value,
onChange,
__unstableInputWidth = '60px',
...otherProps
} ) {
const units = useCustomUnits( {
availableUnits: useSetting( 'spacing.units' ) || [ 'px', 'em', 'rem' ],
defaultValues: { px: 2, em: 0.2, rem: 0.2 },
} );
return (
<UnitControl
{ ...otherProps }
label={ __( 'Letter spacing' ) }
value={ value }
__unstableInputWidth={ __unstableInputWidth }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const LineHeightControl = ( {
/** Start opting into the new margin-free styles that will become the default in a future version. */
__nextHasNoMarginBottom = false,
__unstableInputWidth = '60px',
...otherProps
} ) => {
const isDefined = isLineHeightDefined( lineHeight );

Expand Down Expand Up @@ -89,6 +90,7 @@ const LineHeightControl = ( {
style={ deprecatedStyles }
>
<NumberControl
{ ...otherProps }
__unstableInputWidth={ __unstableInputWidth }
__unstableStateReducer={ stateReducer }
onChange={ onChange }
Expand Down
4 changes: 4 additions & 0 deletions packages/edit-site/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
border-radius: $radius-block-ui;
}

.edit-site-typography-panel__half-width-control {
width: calc((100% - #{$grid-unit-30}) / 2);
}

.edit-site-global-styles-screen-heading-color,
.edit-site-global-styles-screen-typography {
margin: $grid-unit-20;
Expand Down
35 changes: 24 additions & 11 deletions packages/edit-site/src/components/global-styles/typography-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export default function TypographyPanel( { name, element } ) {
value={ selectedLevel }
onChange={ setCurrentTab }
isBlock
size="__unstable-large"
>
<ToggleGroupControlOption
value="heading"
Expand Down Expand Up @@ -192,6 +193,7 @@ export default function TypographyPanel( { name, element } ) {
fontFamilies={ fontFamilies }
value={ fontFamily }
onChange={ setFontFamily }
size="__unstable-large"
/>
) }
{ hasFontSizeEnabled && (
Expand All @@ -200,16 +202,21 @@ export default function TypographyPanel( { name, element } ) {
onChange={ setFontSize }
fontSizes={ fontSizes }
disableCustomFontSizes={ disableCustomFontSizes }
size="__unstable-large"
/>
) }
{ hasLineHeightEnabled && (
<Spacer marginBottom={ 6 }>
<LineHeightControl
__nextHasNoMarginBottom={ true }
value={ lineHeight }
onChange={ setLineHeight }
/>
</Spacer>
<div className="edit-site-typography-panel__half-width-control">
<Spacer marginBottom={ 6 }>
<LineHeightControl
__nextHasNoMarginBottom={ true }
__unstableInputWidth="auto"
value={ lineHeight }
onChange={ setLineHeight }
size="__unstable-large"
/>
</Spacer>
</div>
) }
{ hasAppearanceControl && (
<FontAppearanceControl
Expand All @@ -226,13 +233,19 @@ export default function TypographyPanel( { name, element } ) {
} }
hasFontStyles={ hasFontStyles }
hasFontWeights={ hasFontWeights }
size="__unstable-large"
__nextUnconstrainedWidth
/>
) }
{ hasLetterSpacingControl && (
<LetterSpacingControl
value={ letterSpacing }
onChange={ setLetterSpacing }
/>
<div className="edit-site-typography-panel__half-width-control">
<LetterSpacingControl
value={ letterSpacing }
onChange={ setLetterSpacing }
size="__unstable-large"
__unstableInputWidth="auto"
/>
</div>
) }
</PanelBody>
);
Expand Down