Skip to content

Commit

Permalink
Build: using a postcss plugin to generate the admin-schemes styles (#…
Browse files Browse the repository at this point in the history
…6739)

* Try using a post-css plugin to generate the admin-schemes styles

* Add browserlist config

* Use postCSS color-function to avoid having to declare darkened colors as theme colors

* Fix postcss-themes packages.json indentation

* Fix the form toggle colors

* Add publishConfig to the package.json of postcss-themes

* Fix date picker theme colors

* Fix toggle colors

* Adding a unit test

* Fix sass code style (adding spaces)

* Fix unit tests
  • Loading branch information
youknowriad authored May 15, 2018
1 parent ca2b3d3 commit f920f2d
Show file tree
Hide file tree
Showing 30 changed files with 407 additions and 143 deletions.
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends @wordpress/browserslist-config
2 changes: 1 addition & 1 deletion components/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
&.button-primary.is-busy[disabled] {
color: $white !important;
background-size: 100px 100% !important;
background-image: linear-gradient( -45deg, $blue-medium-500 28%, $blue-dark-900 28%, $blue-dark-900 72%, $blue-medium-500 72%) !important;
background-image: linear-gradient( -45deg, theme( primary ) 28%, $blue-dark-900 28%, $blue-dark-900 72%, theme( primary ) 72%) !important;
border-color: $blue-dark-900 !important;
}

Expand Down
69 changes: 59 additions & 10 deletions components/date-time/style.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
$datepicker__background-color: $light-gray-300;
$datepicker__border-color: $light-gray-500;
$datepicker__highlighted-color: $blue-wordpress;
$datepicker__muted-color: #ccc;
$datepicker__selected-color: $blue-wordpress;
$datepicker__text-color: $dark-gray-500;
$datepicker__header-color: $black;
$datepicker__navigation-disabled-color: lighten($datepicker__muted-color, 10%);

$datepicker__border-radius: 0;
$datepicker__day-margin: 0.166rem;
$datepicker__font-size: 13px;
Expand All @@ -16,6 +7,13 @@ $datepicker__margin: 0.4rem;
$datepicker__navigation-size: 6px;
$datepicker__triangle-size: 6px;

$datepicker__background-color: $light-gray-300;
$datepicker__text-color: $dark-gray-500;
$datepicker__header-color: $black;
$datepicker__muted-color: #ccc;
$datepicker__navigation-disabled-color: lighten($datepicker__muted-color, 10%);
$datepicker__border-color: $light-gray-500;

@import '~react-datepicker/src/stylesheets/datepicker';

.react-datepicker__month-container {
Expand All @@ -29,7 +27,7 @@ $datepicker__triangle-size: 6px;

.react-datepicker__navigation {
top: 12px;

&--previous,
&--previous:hover {
border-right-color: $black;
Expand Down Expand Up @@ -73,3 +71,54 @@ $datepicker__triangle-size: 6px;
transform: translateY(1px);
}
}

// Extending colors to use theme colors
.react-datepicker__time-container {
.react-datepicker__time {
.react-datepicker__time-box {
ul.react-datepicker__time-list {
li.react-datepicker__time-list-item {
&--selected {
background-color: theme( primary );
&:hover {
background-color: theme( primary );
}
}
}
}
}
}
}

.react-datepicker__day {
&--highlighted {
background-color: theme( primary );
&:hover {
background-color: color( theme( primary ) shade(5%) );
}
}

&--selected,
&--in-selecting-range,
&--in-range {
background-color: theme( primary );
&:hover {
background-color: color( theme( primary ) shade(5%) );
}
}

&--keyboard-selected {
background-color: color( theme( primary ) tint(5%) );
&:hover {
background-color: color( theme( primary ) shade(5%) );
}
}

&--in-selecting-range:not(&--in-range) {
background-color: color( theme( primary ) a(50%) );
}
}

.react-datepicker__close-icon::after {
background-color: theme( primary );
}
10 changes: 5 additions & 5 deletions components/form-toggle/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ $toggle-border-width: 2px;

// checked state
&.is-checked .components-form-toggle__track {
background-color: $blue-medium-400;
border: $toggle-border-width solid $blue-medium-400;
background-color: theme( toggle );
border: $toggle-border-width solid theme( toggle );
border: #{ $toggle-height / 2 } solid transparent; // expand the border to fake a solid in Windows High Contrast Mode
}

Expand All @@ -83,8 +83,8 @@ $toggle-border-width: 2px;
}

&:before {
background-color: $blue-medium-500;
border: $toggle-border-width solid $blue-medium-500;
background-color: theme( toggle );
border: $toggle-border-width solid theme( toggle );
}
}
}
Expand Down Expand Up @@ -119,4 +119,4 @@ $toggle-border-width: 2px;
filter: none;
border: 1px solid $white;
}
}
}
2 changes: 1 addition & 1 deletion components/form-token-field/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

.components-form-token-field__token-text {
background: transparent;
color: $blue-wordpress;
color: theme( secondary );
}

.components-form-token-field__remove-token {
Expand Down
4 changes: 2 additions & 2 deletions core-blocks/gallery/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
.blocks-gallery-item {

.is-selected {
outline: 4px solid $blue-medium-500;
outline: 4px solid theme( primary );
outline-offset: -4px;
}

Expand Down Expand Up @@ -67,7 +67,7 @@
position: absolute;
top: 0;
right: 0;
background-color: $blue-medium-500;
background-color: theme( primary );
display: inline-flex;
z-index: z-index( '.core-blocks-gallery-item__inline-menu' );

Expand Down
2 changes: 1 addition & 1 deletion core-blocks/image/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
width: 15px !important;
height: 15px !important;
position: absolute;
background: $blue-medium-500;
background: theme( primary );
padding: 0 3px 3px 0;
box-sizing: border-box;
cursor: se-resize;
Expand Down
2 changes: 1 addition & 1 deletion core-blocks/spacer/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
width: 15px !important;
height: 15px !important;
position: absolute;
background: $blue-medium-500;
background: theme( primary );
padding: 0 3px 3px 0;
box-sizing: border-box;
cursor: se-resize;
Expand Down
95 changes: 0 additions & 95 deletions edit-post/assets/stylesheets/_admin-schemes.scss

This file was deleted.

2 changes: 0 additions & 2 deletions edit-post/assets/stylesheets/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ $white: #fff;

// Additional colors
// some from https://make.wordpress.org/design/handbook/foundations/colors/
$blue-wordpress: #0073aa;
$blue-wordpress-700: #00669b;
$blue-dark-900: #0071a1;

$blue-medium-900: #006589;
$blue-medium-800: #00739C;
$blue-medium-700: #007FAC;
$blue-medium-600: #008DBE;
$blue-medium-500: #00a0d2;
$blue-medium-400: #33B3DB;
$blue-medium-300: #66C6E4;
$blue-medium-200: #BFE7F3;
Expand Down
11 changes: 0 additions & 11 deletions edit-post/assets/stylesheets/main.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
// Output overrides for each scheme
// Almost all schemes use only one color swatch, a few have exceptions to ensure usability
@include admin-scheme-color-overrides( 'fresh', $scheme-fresh__spot-color, $scheme-fresh__spot-color );
@include admin-scheme-color-overrides( 'light', $scheme-light__spot-color, $scheme-light__spot-color );
@include admin-scheme-color-overrides( 'blue', $scheme-blue__spot-color, $scheme-blue__spot-color );
@include admin-scheme-color-overrides( 'coffee', $scheme-coffee__spot-color, $scheme-coffee__spot-color );
@include admin-scheme-color-overrides( 'ectoplasm', $scheme-ectoplasm__spot-color, $scheme-ectoplasm__spot-color );
@include admin-scheme-color-overrides( 'midnight', $scheme-midnight__spot-color, $scheme-midnight__spot-color-2 ); // exception to ensure usability
@include admin-scheme-color-overrides( 'ocean', $scheme-ocean__spot-color, $scheme-ocean__spot-color );
@include admin-scheme-color-overrides( 'sunrise', $scheme-sunrise__spot-color, $scheme-sunrise__spot-color-2 ); // exception to ensure usability

// Fade animations
@keyframes animate_fade {
from {
Expand Down
2 changes: 1 addition & 1 deletion edit-post/components/sidebar/settings-header/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

&.is-active {
padding-bottom: 0;
border-bottom: 3px solid $blue-medium-500;
border-bottom: 3px solid theme( primary );
font-weight: 600;
}

Expand Down
2 changes: 1 addition & 1 deletion edit-post/components/sidebar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@

&.is-active {
padding-bottom: 0;
border-bottom: 3px solid $blue-medium-500;
border-bottom: 3px solid theme( primary );
font-weight: 600;
}

Expand Down
4 changes: 2 additions & 2 deletions editor/components/block-drop-zone/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

&.is-close-to-bottom {
background: none;
border-bottom: 3px solid $blue-medium-500;
border-bottom: 3px solid theme( primary );
}

&.is-close-to-top,
&.is-appender.is-close-to-top,
&.is-appender.is-close-to-bottom {
background: none;
border-top: 3px solid $blue-medium-500;
border-top: 3px solid theme( primary );
border-bottom: none;
}

Expand Down
2 changes: 1 addition & 1 deletion editor/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@
height: 2px;
left: 0;
right: 0;
background: $blue-medium-500;
background: theme( primary );
}

.editor-block-list__insertion-point-inserter {
Expand Down
2 changes: 1 addition & 1 deletion editor/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ input[type="search"].editor-inserter__search {
&.is-active {
padding-bottom: 8px;
font-weight: 600;
border-bottom: 3px solid $blue-medium-500;
border-bottom: 3px solid theme( primary );
position: relative;
z-index: z-index( '.editor-inserter__tab.is-active' );
}
Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-featured-image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

.editor-post-featured-image__toggle {
text-decoration: underline;
color: $blue-wordpress;
color: theme( secondary );

&:focus {
box-shadow: none;
outline: none;
}

&:hover {
color: $blue-medium-500;
color: theme( primary );
}
}

Expand Down
4 changes: 2 additions & 2 deletions editor/components/post-publish-button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
background: none !important;
text-decoration: none !important;
color: $white !important;
border-color: $blue-wordpress $blue-wordpress-700 $blue-wordpress-700 !important;
border-color: theme( secondary ) $blue-wordpress-700 $blue-wordpress-700 !important;
box-shadow: 0 1px 0 $blue-wordpress-700 !important;
text-shadow: 0 -1px 1px $blue-wordpress-700, 1px 0 1px $blue-wordpress-700, 0 1px 1px $blue-wordpress-700, -1px 0 1px $blue-wordpress-700 !important;
// End of the overriding
Expand All @@ -23,7 +23,7 @@
right: 0;
bottom: 0;
content: '';
background-image: repeating-linear-gradient( -45deg, $blue-wordpress-700, $blue-wordpress-700 11px, $blue-wordpress 10px, $blue-wordpress 20px );
background-image: repeating-linear-gradient( -45deg, $blue-wordpress-700, $blue-wordpress-700 11px, theme( secondary ) 10px, theme( secondary ) 20px );
z-index: -1;
@include move_background;
}
Expand Down
Loading

0 comments on commit f920f2d

Please sign in to comment.