Skip to content

Commit

Permalink
Migrate from TextControl to InputControl to remove margin overrides (#…
Browse files Browse the repository at this point in the history
…47161)

* Migrate from TextControl to InputControl to remove margin overrides

* Add back wrap behaviour based on PR feedback
  • Loading branch information
brookewp authored Jan 20, 2023
1 parent 2bf7068 commit c3af62b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
28 changes: 16 additions & 12 deletions packages/block-library/src/rss/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import {
PanelBody,
Placeholder,
RangeControl,
TextControl,
ToggleControl,
ToolbarGroup,
__experimentalHStack as HStack,
__experimentalInputControl as InputControl,
} from '@wordpress/components';
import { useState } from '@wordpress/element';
import { grid, list, edit, rss } from '@wordpress/icons';
Expand Down Expand Up @@ -66,17 +67,20 @@ export default function RSSEdit( { attributes, setAttributes } ) {
onSubmit={ onSubmitURL }
className="wp-block-rss__placeholder-form"
>
<TextControl
placeholder={ __( 'Enter URL here…' ) }
value={ feedURL }
onChange={ ( value ) =>
setAttributes( { feedURL: value } )
}
className="wp-block-rss__placeholder-input"
/>
<Button variant="primary" type="submit">
{ __( 'Use URL' ) }
</Button>
<HStack wrap>
<InputControl
__next36pxDefaultSize
placeholder={ __( 'Enter URL here…' ) }
value={ feedURL }
onChange={ ( value ) =>
setAttributes( { feedURL: value } )
}
className="wp-block-rss__placeholder-input"
/>
<Button variant="primary" type="submit">
{ __( 'Use URL' ) }
</Button>
</HStack>
</form>
</Placeholder>
</div>
Expand Down
19 changes: 4 additions & 15 deletions packages/block-library/src/rss/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
}

.wp-block-rss__placeholder-form {
display: flex;
align-items: stretch;

> * {
margin-bottom: $grid-unit-10;
}
Expand All @@ -15,18 +12,10 @@
margin-bottom: 0;
}
}
}

.wp-block-rss__placeholder-input {
display: flex;
align-items: stretch;
flex-grow: 1;

.components-base-control__field {
margin: 0;
display: flex;
align-items: stretch;
flex-grow: 1;
margin-right: $grid-unit-10;
.wp-block-rss__placeholder-input {
flex: 1;
min-width: 80%;
}
}

0 comments on commit c3af62b

Please sign in to comment.