Skip to content

Commit 0581242

Browse files
committed
fix: use blockClassName in favour of useBlockProps
1 parent 9fed074 commit 0581242

File tree

1 file changed

+4
-8
lines changed
  • src/blocks/my-account-button

1 file changed

+4
-8
lines changed

src/blocks/my-account-button/edit.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,19 @@ import {
2424
} from '@wordpress/block-editor';
2525
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
2626

27-
function MyAccountButtonEdit( { attributes, setAttributes, className: wrapperClassName } ) {
27+
function MyAccountButtonEdit( { attributes, setAttributes } ) {
2828
const { signedInLabel, signedOutLabel, style, className: blockClassName } = attributes;
2929
const borderProps = useBorderProps( attributes );
3030
const colorProps = useColorProps( attributes );
3131
const spacingProps = useSpacingProps( attributes );
32-
33-
// Block style comes from the Styles panel (wrapper) or saved className.
34-
const blockWrapperProps = useBlockProps();
35-
const className = blockWrapperProps?.className ?? wrapperClassName ?? blockClassName ?? '';
36-
const isIconOnly = className.includes( 'is-style-icon-only' );
37-
const isTextOnly = className.includes( 'is-style-text-only' );
32+
const isIconOnly = ( blockClassName || '' ).includes( 'is-style-icon-only' );
33+
const isTextOnly = ( blockClassName || '' ).includes( 'is-style-text-only' );
3834
const isLabelVisible = ! isIconOnly;
3935
const isIconVisible = ! isTextOnly;
4036

4137
const blockProps = useBlockProps( {
4238
className: classnames(
43-
className,
39+
blockClassName,
4440
'wp-block-button__link',
4541
'newspack-reader__account-link',
4642
'wp-block-newspack-my-account-button__link',

0 commit comments

Comments
 (0)