Restore correct font style when the block is loaded in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/5600)

* Restore correct font style when the block is loaded in the editor

Restore correct font style when the block is loaded in the editor

* fix style on Twenty Twenty theme
This commit is contained in:
Luigi Teschio 2022-01-20 10:02:17 +01:00 committed by GitHub
parent 8c7db9b875
commit dd36c00180
2 changed files with 17 additions and 1 deletions

View File

@ -3,7 +3,10 @@
*/
import classnames from 'classnames';
import { HTMLAttributes } from 'react';
import { useProductDataContext } from '@woocommerce/shared-context';
import {
useInnerBlockLayoutContext,
useProductDataContext,
} from '@woocommerce/shared-context';
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
import { withProductDataContext } from '@woocommerce/shared-hocs';
import ProductName from '@woocommerce/base-components/product-name';
@ -58,6 +61,7 @@ export const Block = ( props: Props ): JSX.Element => {
align,
} = props;
const { parentClassName } = useInnerBlockLayoutContext();
const { product } = useProductDataContext();
const { dispatchStoreEvent } = useStoreEvents();
@ -74,6 +78,7 @@ export const Block = ( props: Props ): JSX.Element => {
colorProps.className,
'wc-block-components-product-title',
{
[ `${ parentClassName }__product-title` ]: parentClassName,
[ `wc-block-components-product-title--align-${ align }` ]:
align && isFeaturePluginBuild(),
}
@ -99,6 +104,7 @@ export const Block = ( props: Props ): JSX.Element => {
colorProps.className,
'wc-block-components-product-title',
{
[ `${ parentClassName }__product-title` ]: parentClassName,
[ `wc-block-components-product-title--align-${ align }` ]:
align && isFeaturePluginBuild(),
}

View File

@ -1,3 +1,13 @@
.editor-styles-wrapper a.wc-block-components-product-name {
color: inherit;
}
.editor-styles-wrapper .wc-block-components-product-title {
margin-top: 0;
margin-bottom: $gap-small;
line-height: 1.5;
font-weight: 700;
padding: 0;
display: block;
font-size: inherit;
}