Skip to content

Commit f9eb6ce

Browse files
mikachant-hamano
andauthored
Accordion Header: Remove textAlignment and textAlign (#71875)
* Remove textAlignment attribute * Remove textAlign logic * Remove clsx * Remove unused classname * Remove textAlign support Co-authored-by: mikachan <mikachan@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
1 parent b9a4663 commit f9eb6ce

File tree

4 files changed

+8
-29
lines changed

4 files changed

+8
-29
lines changed

docs/reference-guides/core-blocks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Displays an accordion header. ([Source](https://github.com/WordPress/gutenberg/t
3939
- **Experimental:** true
4040
- **Category:** design
4141
- **Parent:** core/accordion-content
42-
- **Supports:** anchor, color (background, gradients, text), interactivity, shadow, spacing (padding), typography (fontSize, textAlign), ~~align~~
43-
- **Attributes:** iconPosition, level, levelOptions, openByDefault, showIcon, textAlignment, title
42+
- **Supports:** anchor, color (background, gradients, text), interactivity, shadow, spacing (padding), typography (fontSize), ~~align~~
43+
- **Attributes:** iconPosition, level, levelOptions, openByDefault, showIcon, title
4444

4545
## Accordion Panel
4646

packages/block-library/src/accordion-header/block.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
}
4040
},
4141
"typography": {
42-
"textAlign": true,
4342
"fontSize": true,
4443
"__experimentalFontFamily": true,
4544
"__experimentalFontWeight": true,
@@ -72,10 +71,6 @@
7271
"levelOptions": {
7372
"type": "array"
7473
},
75-
"textAlignment": {
76-
"type": "string",
77-
"default": "left"
78-
},
7974
"iconPosition": {
8075
"type": "string",
8176
"enum": [ "left", "right" ],

packages/block-library/src/accordion-header/edit.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* External dependencies
3-
*/
4-
import clsx from 'clsx';
51
/**
62
* WordPress dependencies
73
*/
@@ -17,7 +13,7 @@ import {
1713
import { ToolbarGroup } from '@wordpress/components';
1814

1915
export default function Edit( { attributes, setAttributes, context } ) {
20-
const { level, title, textAlign, levelOptions } = attributes;
16+
const { level, title, levelOptions } = attributes;
2117
const {
2218
'core/accordion-icon-position': iconPosition,
2319
'core/accordion-show-icon': showIcon,
@@ -34,11 +30,7 @@ export default function Edit( { attributes, setAttributes, context } ) {
3430
}
3531
}, [ iconPosition, showIcon, setAttributes ] );
3632

37-
const blockProps = useBlockProps( {
38-
className: clsx( 'accordion-content__heading', {
39-
[ `has-text-align-${ textAlign }` ]: textAlign,
40-
} ),
41-
} );
33+
const blockProps = useBlockProps();
4234
const spacingProps = useSpacingProps( attributes );
4335

4436
return (
@@ -56,7 +48,7 @@ export default function Edit( { attributes, setAttributes, context } ) {
5648
</BlockControls>
5749
<TagName { ...blockProps }>
5850
<button
59-
className={ clsx( 'wp-block-accordion-header__toggle' ) }
51+
className="wp-block-accordion-header__toggle"
6052
style={ {
6153
...spacingProps.style,
6254
} }

packages/block-library/src/accordion-header/save.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* External dependencies
3-
*/
4-
import clsx from 'clsx';
51
/**
62
* WordPress dependencies
73
*/
@@ -12,20 +8,16 @@ import {
128
} from '@wordpress/block-editor';
139

1410
export default function save( { attributes } ) {
15-
const { level, title, iconPosition, textAlign, showIcon } = attributes;
11+
const { level, title, iconPosition, showIcon } = attributes;
1612
const TagName = 'h' + level;
1713

18-
const blockProps = useBlockProps.save( {
19-
className: clsx( 'accordion-content__heading', {
20-
[ `has-text-align-${ textAlign }` ]: textAlign,
21-
} ),
22-
} );
14+
const blockProps = useBlockProps.save();
2315
const spacingProps = getSpacingClassesAndStyles( attributes );
2416

2517
return (
2618
<TagName { ...blockProps }>
2719
<button
28-
className={ clsx( 'wp-block-accordion-header__toggle' ) }
20+
className="wp-block-accordion-header__toggle"
2921
style={ {
3022
...spacingProps.style,
3123
} }

0 commit comments

Comments
 (0)