-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Button: Add __next40pxDefaultSize in block-editor 6
#65742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,18 +3,9 @@ | |
| top: -9999em; | ||
|
|
||
| &:focus { | ||
| height: auto; | ||
| width: auto; | ||
| display: block; | ||
| font-size: 14px; | ||
| font-weight: 600; | ||
| padding: 15px 23px 14px; | ||
| background: #f1f1f1; | ||
| color: var(--wp-admin-theme-color); | ||
| line-height: normal; | ||
| box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); | ||
| text-decoration: none; | ||
| outline: none; | ||
| z-index: z-index(".skip-to-selected-block"); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed some arbitrary and/or seemingly unnecessary style overrides. Maybe we can also remove the font size and weight, but left those as is for now.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we remove the background styles too?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can kind of see how someone would want a background color here, given that the button floats above a white background. I'd say a complete reconsideration of the remaining overrides (font size, weight, background) is a separate issue. |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,8 +44,7 @@ function ToolSelector( props, ref ) { | |
| <Dropdown | ||
| renderToggle={ ( { isOpen, onToggle } ) => ( | ||
| <Button | ||
| // TODO: Switch to `true` (40px size) if possible | ||
| __next40pxDefaultSize={ false } | ||
| size="compact" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| { ...props } | ||
| ref={ ref } | ||
| icon={ mode === 'navigation' ? editIcon : selectIcon } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,10 @@ | |||||
| */ | ||||||
| import { __ } from '@wordpress/i18n'; | ||||||
| import { Component } from '@wordpress/element'; | ||||||
| import { Button } from '@wordpress/components'; | ||||||
| import { | ||||||
| Button, | ||||||
| __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper, | ||||||
| } from '@wordpress/components'; | ||||||
| import { link, keyboardReturn, arrowLeft } from '@wordpress/icons'; | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -38,8 +41,7 @@ class URLInputButton extends Component { | |||||
| return ( | ||||||
| <div className="block-editor-url-input__button"> | ||||||
| <Button | ||||||
| // TODO: Switch to `true` (40px size) if possible | ||||||
| __next40pxDefaultSize={ false } | ||||||
| size="compact" | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't used in the app anymore, so I tested with a story. diff --git a/packages/block-editor/src/components/url-input/stories/index.story.js b/packages/block-editor/src/components/url-input/stories/index.story.js
new file mode 100644
index 0000000000..68a5bc360b
--- /dev/null
+++ b/packages/block-editor/src/components/url-input/stories/index.story.js
@@ -0,0 +1,10 @@
+/**
+ * Internal dependencies
+ */
+import URLInputButton from '../button';
+
+export default { title: 'BlockEditor/URLInputButton' };
+
+export const Default = () => {
+ return <URLInputButton />;
+};
I doubt anyone uses this anymore, since the styles are kind of broken/outdated already. I changed it to use the same |
||||||
| icon={ link } | ||||||
| label={ buttonLabel } | ||||||
| onClick={ this.toggle } | ||||||
|
|
@@ -53,8 +55,7 @@ class URLInputButton extends Component { | |||||
| > | ||||||
| <div className="block-editor-url-input__button-modal-line"> | ||||||
| <Button | ||||||
| // TODO: Switch to `true` (40px size) if possible | ||||||
| __next40pxDefaultSize={ false } | ||||||
| __next40pxDefaultSize | ||||||
| className="block-editor-url-input__back" | ||||||
| icon={ arrowLeft } | ||||||
| label={ __( 'Close' ) } | ||||||
|
|
@@ -63,13 +64,16 @@ class URLInputButton extends Component { | |||||
| <URLInput | ||||||
| value={ url || '' } | ||||||
| onChange={ onChange } | ||||||
| /> | ||||||
| <Button | ||||||
| // TODO: Switch to `true` (40px size) if possible | ||||||
| __next40pxDefaultSize={ false } | ||||||
| icon={ keyboardReturn } | ||||||
| label={ __( 'Submit' ) } | ||||||
| type="submit" | ||||||
| suffix={ | ||||||
| <InputControlSuffixWrapper variant="control"> | ||||||
| <Button | ||||||
| size="small" | ||||||
| icon={ keyboardReturn } | ||||||
| label={ __( 'Submit' ) } | ||||||
| type="submit" | ||||||
| /> | ||||||
| </InputControlSuffixWrapper> | ||||||
| } | ||||||
| /> | ||||||
| </div> | ||||||
| </form> | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -540,8 +540,7 @@ class URLInput extends Component { | |||||
| > | ||||||
| { suggestions.map( ( suggestion, index ) => ( | ||||||
| <Button | ||||||
| // TODO: Switch to `true` (40px size) if possible | ||||||
| __next40pxDefaultSize={ false } | ||||||
| __next40pxDefaultSize | ||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Insert a Paragraph block, select a string range and click the Link button in the block toolbar. I'm not sure what conditions are needed to reach this code naturally — it's not what you normally see in a URLInput in Gutenberg. To force the condition, you can comment out the block with the
|
||||||
| { ...buildSuggestionItemProps( suggestion, index ) } | ||||||
| key={ suggestion.id } | ||||||
| className={ clsx( | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,10 +109,4 @@ $input-size: 300px; | |
| flex-shrink: 1; | ||
| min-width: 0; | ||
| align-items: flex-start; | ||
|
|
||
| .components-button { | ||
| flex-shrink: 0; | ||
| width: $button-size; | ||
| height: $button-size; | ||
| } | ||
|
Comment on lines
-112
to
-117
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This used to apply in the URLInputButton. No longer seems necessary. |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,6 @@ import { | |
| arrowDown, | ||
| } from '@wordpress/icons'; | ||
| import { | ||
| Button, | ||
| ToggleControl, | ||
| Flex, | ||
| FlexItem, | ||
|
|
@@ -110,7 +109,6 @@ export default { | |
| <FlexLayoutVerticalAlignmentControl | ||
| layout={ layout } | ||
| onChange={ onChange } | ||
| isToolbar | ||
| /> | ||
| ) } | ||
| </BlockControls> | ||
|
|
@@ -190,11 +188,7 @@ export default { | |
| }, | ||
| }; | ||
|
|
||
| function FlexLayoutVerticalAlignmentControl( { | ||
| layout, | ||
| onChange, | ||
| isToolbar = false, | ||
| } ) { | ||
| function FlexLayoutVerticalAlignmentControl( { layout, onChange } ) { | ||
| const { orientation = 'horizontal' } = layout; | ||
|
|
||
| const defaultVerticalAlignment = | ||
|
|
@@ -210,54 +204,17 @@ function FlexLayoutVerticalAlignmentControl( { | |
| verticalAlignment: value, | ||
| } ); | ||
| }; | ||
| if ( isToolbar ) { | ||
| return ( | ||
| <BlockVerticalAlignmentControl | ||
| onChange={ onVerticalAlignmentChange } | ||
| value={ verticalAlignment } | ||
| controls={ | ||
| orientation === 'horizontal' | ||
| ? [ 'top', 'center', 'bottom', 'stretch' ] | ||
| : [ 'top', 'center', 'bottom', 'space-between' ] | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| const verticalAlignmentOptions = [ | ||
| { | ||
| value: 'flex-start', | ||
| label: __( 'Align items top' ), | ||
| }, | ||
| { | ||
| value: 'center', | ||
| label: __( 'Align items center' ), | ||
| }, | ||
| { | ||
| value: 'flex-end', | ||
| label: __( 'Align items bottom' ), | ||
| }, | ||
| ]; | ||
|
|
||
| return ( | ||
| <fieldset className="block-editor-hooks__flex-layout-vertical-alignment-control"> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
| <legend>{ __( 'Vertical alignment' ) }</legend> | ||
| <div> | ||
| { verticalAlignmentOptions.map( ( value, icon, label ) => { | ||
| return ( | ||
| <Button | ||
| // TODO: Switch to `true` (40px size) if possible | ||
| __next40pxDefaultSize={ false } | ||
| key={ value } | ||
| label={ label } | ||
| icon={ icon } | ||
| isPressed={ verticalAlignment === value } | ||
| onClick={ () => onVerticalAlignmentChange( value ) } | ||
| /> | ||
| ); | ||
| } ) } | ||
| </div> | ||
| </fieldset> | ||
| <BlockVerticalAlignmentControl | ||
| onChange={ onVerticalAlignmentChange } | ||
| value={ verticalAlignment } | ||
| controls={ | ||
| orientation === 'horizontal' | ||
| ? [ 'top', 'center', 'bottom', 'stretch' ] | ||
| : [ 'top', 'center', 'bottom', 'space-between' ] | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
|
|
||





There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insert a Paragraph block, and hit Tab all the way through the block inspector sidebar until this skip button pops up.