Skip to content

Commit

Permalink
TextareaControl: add new opt-in prop (#46559)
Browse files Browse the repository at this point in the history
* TextareaControl: add new opt-in prop

* Remove margin bottom and replace div with VStack for Disabled component

* Update Changelog

* Revert "Update Changelog"
  • Loading branch information
brookewp committed Dec 16, 2022
1 parent ec33dae commit 4b4c4be
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export default function CoverInspectorControls( {
isImageBackground &&
isImgElement && (
<TextareaControl
__nextHasNoMarginBottom
label={ __(
'Alt text (alternative text)'
) }
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ export default function Image( {
<PanelBody title={ __( 'Settings' ) }>
{ ! multiImageSelection && (
<TextareaControl
__nextHasNoMarginBottom
label={ __( 'Alt text (alternative text)' ) }
value={ alt }
onChange={ updateAlt }
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/media-text/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ function MediaTextEdit( { attributes, isSelected, setAttributes, clientId } ) {
) }
{ mediaType === 'image' && (
<TextareaControl
__nextHasNoMarginBottom
label={ __( 'Alt text (alternative text)' ) }
value={ mediaAlt }
onChange={ onMediaAltChange }
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ export default function NavigationLinkEdit( {
autoComplete="off"
/>
<TextareaControl
__nextHasNoMarginBottom
value={ description || '' }
onChange={ ( descriptionValue ) => {
setAttributes( { description: descriptionValue } );
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/navigation-submenu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ export default function NavigationSubmenuEdit( {
autoComplete="off"
/>
<TextareaControl
__nextHasNoMarginBottom
value={ description || '' }
onChange={ ( descriptionValue ) => {
setAttributes( {
Expand Down
8 changes: 6 additions & 2 deletions packages/components/src/disabled/stories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Disabled from '../';
import SelectControl from '../../select-control/';
import TextControl from '../../text-control/';
import TextareaControl from '../../textarea-control/';
import { VStack } from '../../v-stack/';

const meta: ComponentMeta< typeof Disabled > = {
title: 'Components/Disabled',
Expand All @@ -37,18 +38,21 @@ const Form = () => {
const [ textControlValue, setTextControlValue ] = useState( '' );
const [ textAreaValue, setTextAreaValue ] = useState( '' );
return (
<div>
<VStack>
<TextControl
__nextHasNoMarginBottom
label="Text Control"
value={ textControlValue }
onChange={ setTextControlValue }
/>
<TextareaControl
__nextHasNoMarginBottom
label="TextArea Control"
value={ textAreaValue }
onChange={ setTextAreaValue }
/>
<SelectControl
__nextHasNoMarginBottom
label="Select Control"
onChange={ () => {} }
options={ [
Expand All @@ -58,7 +62,7 @@ const Form = () => {
{ value: 'c', label: 'Option C' },
] }
/>
</div>
</VStack>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function CustomCSSControl() {
return (
<>
<TextareaControl
__nextHasNoMarginBottom
value={
customCSS?.replace( ignoreThemeCustomCSS, '' ) ||
themeCustomCSS
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/post-excerpt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function PostExcerpt( { excerpt, onUpdateExcerpt } ) {
return (
<div className="editor-post-excerpt">
<TextareaControl
__nextHasNoMarginBottom
label={ __( 'Write an excerpt (optional)' ) }
className="editor-post-excerpt__textarea"
onChange={ ( value ) => onUpdateExcerpt( value ) }
Expand Down

1 comment on commit 4b4c4be

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3716585078
📝 Reported issues:

Please sign in to comment.