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

FontAppearanceControl: use CustomSelectControl V2 legacy adapter #63179

Merged
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
@@ -1,15 +1,19 @@
/**
* WordPress dependencies
*/
import { CustomSelectControl } from '@wordpress/components';
import { privateApis as componentsPrivateApis } from '@wordpress/components';
import { useMemo } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import { getFontStylesAndWeights } from '../../utils/get-font-styles-and-weights';
import { unlock } from '../../lock-unlock';

const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
componentsPrivateApis
);
/**
* Adjusts font appearance field label in case either font styles or weights
* are disabled.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.components-font-appearance-control {
ul {
li {
color: $gray-900;
text-transform: capitalize;
}
[role="option"] {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switching from ul > li to [role="option"] was necessary because the new version of CustomSelectControl doesn't use ul and lis — and in general it makes these styles more resilient to future changes.

color: $gray-900;
text-transform: capitalize;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ export default function TypographyPanel( {
hasFontWeights={ hasFontWeights }
fontFamilyFaces={ fontFamilyFaces }
size="__unstable-large"
__nextHasNoMarginBottom
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing __nextHasNoMarginBottom since it's not even a valid prop anymore for CustomSelectControl. The component doesn't have a bottom margin anyway

/>
</ToolsPanelItem>
) }
Expand Down
Loading