diff --git a/packages/block-editor/src/components/text-decoration-control/index.js b/packages/block-editor/src/components/text-decoration-control/index.js index 9edfb9b4a0195c..44635602c947a5 100644 --- a/packages/block-editor/src/components/text-decoration-control/index.js +++ b/packages/block-editor/src/components/text-decoration-control/index.js @@ -1,7 +1,15 @@ +/** + * External dependencies + */ +import classnames from 'classnames'; + /** * WordPress dependencies */ -import { BaseControl, Button } from '@wordpress/components'; +import { + __experimentalToggleGroupControl as ToggleGroupControl, + __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, +} from '@wordpress/components'; import { formatStrikethrough, formatUnderline } from '@wordpress/icons'; import { __ } from '@wordpress/i18n'; @@ -21,38 +29,41 @@ const TEXT_DECORATIONS = [ /** * Control to facilitate text decoration selections. * - * @param {Object} props Component props. - * @param {string} props.value Currently selected text decoration. - * @param {Function} props.onChange Handles change in text decoration selection. + * @param {Object} props Component props. + * @param {string} props.value Currently selected text decoration. + * @param {Function} props.onChange Handles change in text decoration selection. + * @param {string} [props.className] Additional class name to apply. * * @return {WPElement} Text decoration control. */ -export default function TextDecorationControl( { value, onChange } ) { +export default function TextDecorationControl( { + value, + onChange, + className, + ...props +} ) { return ( -
- - { __( 'Decoration' ) } - -
- { TEXT_DECORATIONS.map( ( textDecoration ) => { - return ( -
-
+ + { TEXT_DECORATIONS.map( ( textDecoration ) => { + return ( + + ); + } ) } + ); } diff --git a/packages/block-editor/src/components/text-decoration-control/stories/index.js b/packages/block-editor/src/components/text-decoration-control/stories/index.js new file mode 100644 index 00000000000000..cb50e4cd6c6f73 --- /dev/null +++ b/packages/block-editor/src/components/text-decoration-control/stories/index.js @@ -0,0 +1,37 @@ +/** + * WordPress dependencies + */ +import { useState } from '@wordpress/element'; + +/** + * Internal dependencies + */ +import TextDecorationControl from '../'; + +export default { + title: 'BlockEditor/TextDecorationControl', + component: TextDecorationControl, + argTypes: { + onChange: { action: 'onChange' }, + size: { + options: [ 'default', '__unstable-large' ], + control: { type: 'radio' }, + }, + }, +}; + +const Template = ( { onChange, ...args } ) => { + const [ value, setValue ] = useState(); + return ( + { + onChange( ...changeArgs ); + setValue( ...changeArgs ); + } } + value={ value } + /> + ); +}; + +export const Default = Template.bind( {} ); diff --git a/packages/block-editor/src/components/text-decoration-control/style.scss b/packages/block-editor/src/components/text-decoration-control/style.scss deleted file mode 100644 index f5d5848d3d3034..00000000000000 --- a/packages/block-editor/src/components/text-decoration-control/style.scss +++ /dev/null @@ -1,18 +0,0 @@ -.block-editor-text-decoration-control { - flex: 0 0 50%; - - legend { - margin-bottom: 8px; - } - - .block-editor-text-decoration-control__buttons { - display: inline-flex; - margin-bottom: 24px; - - .components-button.has-icon { - min-width: 24px; - padding: 0; - margin-right: 4px; - } - } -} diff --git a/packages/block-editor/src/components/text-transform-control/index.js b/packages/block-editor/src/components/text-transform-control/index.js index 6d85ae7b421b7a..c71c85993f5ac6 100644 --- a/packages/block-editor/src/components/text-transform-control/index.js +++ b/packages/block-editor/src/components/text-transform-control/index.js @@ -1,7 +1,13 @@ +/** + * External dependencies + */ /** * WordPress dependencies */ -import { BaseControl, Button } from '@wordpress/components'; +import { + __experimentalToggleGroupControl as ToggleGroupControl, + __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, +} from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { formatCapitalize, @@ -36,32 +42,26 @@ const TEXT_TRANSFORMS = [ * * @return {WPElement} Text transform control. */ -export default function TextTransformControl( { value, onChange } ) { +export default function TextTransformControl( { value, onChange, ...props } ) { return ( -
- - { __( 'Letter case' ) } - -
- { TEXT_TRANSFORMS.map( ( textTransform ) => { - return ( -
-
+ + { TEXT_TRANSFORMS.map( ( textTransform ) => { + return ( + + ); + } ) } + ); } diff --git a/packages/block-editor/src/components/text-transform-control/stories/index.js b/packages/block-editor/src/components/text-transform-control/stories/index.js new file mode 100644 index 00000000000000..3219d714257e81 --- /dev/null +++ b/packages/block-editor/src/components/text-transform-control/stories/index.js @@ -0,0 +1,37 @@ +/** + * WordPress dependencies + */ +import { useState } from '@wordpress/element'; + +/** + * Internal dependencies + */ +import TextTransformControl from '../'; + +export default { + title: 'BlockEditor/TextTransformControl', + component: TextTransformControl, + argTypes: { + onChange: { action: 'onChange' }, + size: { + options: [ 'default', '__unstable-large' ], + control: { type: 'radio' }, + }, + }, +}; + +const Template = ( { onChange, ...args } ) => { + const [ value, setValue ] = useState(); + return ( + { + onChange( ...changeArgs ); + setValue( ...changeArgs ); + } } + value={ value } + /> + ); +}; + +export const Default = Template.bind( {} ); diff --git a/packages/block-editor/src/components/text-transform-control/style.scss b/packages/block-editor/src/components/text-transform-control/style.scss deleted file mode 100644 index 09280029a971aa..00000000000000 --- a/packages/block-editor/src/components/text-transform-control/style.scss +++ /dev/null @@ -1,18 +0,0 @@ -.block-editor-text-transform-control { - flex: 0 0 50%; - - legend { - margin-bottom: 8px; - } - - .block-editor-text-transform-control__buttons { - display: inline-flex; - margin-bottom: 24px; - - .components-button.has-icon { - min-width: 24px; - padding: 0; - margin-right: 4px; - } - } -} diff --git a/packages/block-editor/src/style.scss b/packages/block-editor/src/style.scss index 614f611cec2aff..b2c08654ebea64 100644 --- a/packages/block-editor/src/style.scss +++ b/packages/block-editor/src/style.scss @@ -46,8 +46,6 @@ @import "./components/responsive-block-control/style.scss"; @import "./components/rich-text/style.scss"; @import "./components/skip-to-selected-block/style.scss"; -@import "./components/text-transform-control/style.scss"; -@import "./components/text-decoration-control/style.scss"; @import "./components/tool-selector/style.scss"; @import "./components/url-input/style.scss"; @import "./components/url-popover/style.scss";