Skip to content

Commit

Permalink
Merge pull request #3427 from WordPress/polish/button
Browse files Browse the repository at this point in the history
Polish the button
  • Loading branch information
jasmussen authored Nov 13, 2017
2 parents 0d0caf1 + 34f3f4e commit 67a3a63
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 20 deletions.
33 changes: 33 additions & 0 deletions blocks/library/button/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,36 @@ $blocks-button__height: 46px;
cursor: text;
}
}

.blocks-button__inline-link {
background: #fff;
width: 280px;
display: flex;
flex-wrap: wrap;
align-items: center;
font-family: $default-font;
font-size: $default-font-size;
line-height: $default-line-height;

.blocks-url-input {
width: auto;
}

.dashicon {
color: $dark-gray-100;
}

.blocks-url-input input[type=text]::placeholder {
color: $dark-gray-100;
}

[data-align="center"] & {
margin-left: auto;
margin-right: auto;
}

[data-align="right"] & {
margin-left: auto;
margin-right: 0;
}
}
25 changes: 13 additions & 12 deletions blocks/library/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { IconButton, PanelBody } from '@wordpress/components';
import { Dashicon, IconButton, PanelBody } from '@wordpress/components';

/**
* Internal dependencies
Expand Down Expand Up @@ -93,17 +93,6 @@ registerBlockType( 'core/button', {
} }
keepPlaceholderOnFocus
/>
{ focus &&
<form
className="blocks-format-toolbar__link-modal"
onSubmit={ ( event ) => event.preventDefault() }>
<UrlInput
value={ url }
onChange={ ( value ) => setAttributes( { url: value } ) }
/>
<IconButton icon="editor-break" label={ __( 'Apply' ) } type="submit" />
</form>
}
{ focus &&
<InspectorControls key="inspector">
<BlockDescription>
Expand All @@ -130,6 +119,18 @@ registerBlockType( 'core/button', {
</InspectorControls>
}
</span>,
focus && (
<form
className="blocks-button__inline-link"
onSubmit={ ( event ) => event.preventDefault() }>
<Dashicon icon="admin-links" />
<UrlInput
value={ url }
onChange={ ( value ) => setAttributes( { url: value } ) }
/>
<IconButton icon="editor-break" label={ __( 'Apply' ) } type="submit" />
</form>
),
];
},

Expand Down
13 changes: 5 additions & 8 deletions blocks/library/button/style.scss
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
$blocks-button__height: 46px;

.wp-block-button {
font-family: $default-font;
display: inline-block;
text-decoration: none;
font-size: $big-font-size;
margin: 0;
padding: 0 24px;
height: $blocks-button__height;
line-height: $blocks-button__height;
cursor: default;
border-radius: $blocks-button__height / 2;
white-space: nowrap;
background: $blue-medium-400;
color: $white;
background: currentColor;
vertical-align: top;
position: relative;

> div {
color: $white;
}

a {
box-shadow: none !important;
color: $white;
cursor: pointer;
text-decoration: none !important;
}

&:hover {
color: $white;
}

&.aligncenter {
display: inline-block;
}
Expand Down

0 comments on commit 67a3a63

Please sign in to comment.