Skip to content

Commit

Permalink
Override core styles.
Browse files Browse the repository at this point in the history
This commit overrides core input styles, by replicating the existing styles and overriding.

It also changes the "regular-text" class to "input-control" per suggestion from @paulwilde.
  • Loading branch information
jasmussen committed Apr 11, 2018
1 parent 9f5f373 commit ee70ff6
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 22 deletions.
2 changes: 1 addition & 1 deletion blocks/library/shortcode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const settings = {
{ __( 'Shortcode' ) }
</label>
<PlainText
className="regular-text"
className="input-control"
id={ inputId }
value={ attributes.text }
placeholder={ __( 'Write shortcode here…' ) }
Expand Down
2 changes: 1 addition & 1 deletion blocks/library/shortcode/test/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exports[`core/shortcode block edit matches snapshot 1`] = `
Shortcode
</label>
<textarea
class="blocks-plain-text regular-text"
class="blocks-plain-text input-control"
id="blocks-shortcode-input-0"
placeholder="Write shortcode here…"
rows="1"
Expand Down
36 changes: 18 additions & 18 deletions components/form-token-field/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,26 @@
flex-wrap: wrap;
align-items: flex-start;
padding: 4px;
}

// Token input
input[type="text"].components-form-token-field__input {
display: inline-block;
width: auto;
max-width: 100%;
margin: 2px 0 2px 8px;
padding: 0;
line-height: 24px;
background: inherit;
border: 0;
font-size: $default-font-size;
color: $dark-gray-800;
box-shadow: none;

&:focus,
.components-form-token-field.is-active & {
outline: none;
// Token input
input[type="text"].components-form-token-field__input {
display: inline-block;
width: auto;
max-width: 100%;
margin: 2px 0 2px 8px;
padding: 0;
line-height: 24px;
background: inherit;
border: 0;
font-size: $default-font-size;
color: $dark-gray-800;
box-shadow: none;

&:focus,
.components-form-token-field.is-active & {
outline: none;
box-shadow: none;
}
}
}

Expand Down
23 changes: 22 additions & 1 deletion edit-post/assets/stylesheets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,29 @@ body.gutenberg-editor-page {
}
}

// Override core input styles to provide ones consistent with Gutenberg
// @todo submit as upstream patch as well
.edit-post-sidebar,
.editor-post-publish-panel,
.editor-block-list__block {
.regular-text, // this is the upstream WordPress base input class, we override to unify the colors with the new grays pending https://core.trac.wordpress.org/ticket/40633
.input-control, // upstream name is .regular-text
input[type=text],
input[type=search],
input[type=radio],
input[type=tel],
input[type=time],
input[type=url],
input[type=week],
input[type=password],
input[type=checkbox],
input[type=color],
input[type=date],
input[type=datetime],
input[type=datetime-local],
input[type=email],
input[type=month],
input[type=number],
select,
textarea {
border: 1px solid $light-gray-700;
font-family: $default-font;
Expand All @@ -134,6 +154,7 @@ body.gutenberg-editor-page {
}
}

// Placeholder colors
.editor-post-title,
.editor-block-list__block {
input,
Expand Down
2 changes: 1 addition & 1 deletion editor/components/post-excerpt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function PostExcerpt( { excerpt, onUpdateExcerpt, instanceId } ) {
<label key="label" htmlFor={ id }>{ __( 'Write an excerpt (optional)' ) }</label>
<textarea
id={ id }
className="editor-post-excerpt__textarea regular-text"
className="editor-post-excerpt__textarea"
onChange={ onChange }
value={ excerpt }
/>
Expand Down

0 comments on commit ee70ff6

Please sign in to comment.