Skip to content
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

Blockbase: move button padding styles from ponyfill to theme.json #5901

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 40 additions & 91 deletions blockbase/assets/ponyfill.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion blockbase/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function blockbase_support() {
// Enqueue editor styles.
add_editor_style(
array(
'/assets/ponyfill.css',
'/assets/ponyfill.css'
)
);

Expand Down
2 changes: 1 addition & 1 deletion blockbase/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions blockbase/sass/_style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* This is a refactored style sheet
* Currently it is being loaded within ponyfill
* As ponyfill gets refactored, add the necessary styles here.
*/

/*
* Button hover styles.
* Necessary until the following issue is resolved in Gutenberg:
* https://github.com/WordPress/gutenberg/issues/27075
*/

:is(
.wp-block-search__button,
.wp-block-button__link
):is(
:hover,
:active,
:focus
) {
text-decoration: none;
cursor: pointer;
color: var(--wp--custom--button--hover--color--text);
background-color: var(--wp--custom--button--hover--color--background);
border-color: var(--wp--custom--button--hover--border--color);
}

:is(
.wp-block-search__button,
.wp-block-button__link
):focus {
outline: 1.5px dotted var(--wp--preset--color--foreground);
outline-offset: 3px;
}

:is(
.is-style-outline.wp-block-button,
.is-style-outline.wp-block-button__link
) {
color: var(--wp--custom--button--outline--color--text, var(--wp--custom--button--border--color) );
}

:is(
.is-style-outline>.wp-block-button__link,
.is-style-outline.wp-block-button__link
):not(.has-background):hover {
color: var(--wp--custom--button--outline--hover--color--text, var(--wp--custom--button--color--text));
background-color: var(--wp--custom--button--outline--hover--color--background, var(--wp--custom--button--color--background));
}


37 changes: 2 additions & 35 deletions blockbase/sass/blocks/_button.scss
Original file line number Diff line number Diff line change
@@ -1,36 +1,3 @@
@import 'button-mixins';
/**
* Button
*/

/**
* Block Options
*/
.wp-block-button, .wp-block-button__link {
&.wp-block-button__link,
.wp-block-button__link {
@include button-hover-styles;
@include button-padding-styles;
text-decoration: none;
font-weight: var(--wp--custom--button--typography--font-weight);
}
&.is-style-outline {
&.wp-block-button__link,
.wp-block-button__link {
--wp--custom--button--color--text: var(--wp--custom--button--border--color);
--wp--custom--button--color--background: transparent;
@include button-border-styles;
@include button-hover-styles;
@include button-color-styles;
}
}
}

// TODO: I'm not sure what the end goal should be here, but since we are unable to use
// a button block OUTSIDE of the context of the button collection block (grrrrrrrrr)
// then there are undesired margins to be dealt with somehow.
.wp-block-buttons {
.wp-block-button:last-child {
margin-bottom: 0;
}
.wp-block-button:not(.is-style-outline) > a.has-background {
border-style: none;
}
40 changes: 10 additions & 30 deletions blockbase/sass/blocks/_buttons-outline-style.scss
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
@import 'button-mixins';
.wp-block-button {
&.wp-block-button__link,
.wp-block-button__link {
&:not(.has-background):not(.has-text-color) {
@include button-outline-hover-styles;
}
}
}
@import "button-mixins";

.wp-block-file .wp-block-file__button {
@include button-outline-hover-styles;
}

.wp-block-search {
&.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button,
.wp-block-search__button {
@include button-outline-hover-styles;
}
@include button-outline-hover-styles;
}

//NOTE: Double-classed to raise specificity above parent theme's outline hover styles
//as an alternative to !important. Only needed for the editor.
.wp-block-button.wp-block-button.is-style-outline {
&.wp-block-button__link,
.wp-block-button__link {
&:not(.has-background):not(.has-text-color) {
&:hover,
&:focus,
&.has-focus {
color: var(--wp--custom--button--color--background);
background-color: var(--wp--custom--button--color--text);
}
}
}
.wp-block-search {

&.wp-block-search__button-inside .wp-block-search__inside-wrapper .wp-block-search__button,
.wp-block-search__button {

@include button-outline-hover-styles;
}
}
2 changes: 2 additions & 0 deletions blockbase/sass/ponyfill.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@
@import "blocks/table";
@import "blocks/video";
@import "post/meta";

@import "style";
31 changes: 30 additions & 1 deletion blockbase/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,24 @@
"fontSize": "var(--wp--custom--font-sizes--normal)",
"fontWeight": "normal",
"lineHeight": 2
},
"outline":{
"color": {
"text": "var(--wp--custom--color--primary)",
"background": "var(--wp--custom--color--background)"
},
"border": {
"color": "var(--wp--custom--color--primary)"
},
"hover": {
"color": {
"text": "var(--wp--custom--color--background)",
"background": "var(--wp--custom--color--secondary)"
},
"border": {
"color": "var(--wp--custom--color--primary)"
}
}
}
},
"color": {
Expand Down Expand Up @@ -401,7 +419,10 @@
"blocks": {
"core/button": {
"border": {
"radius": "var(--wp--custom--button--border--radius)"
"radius": "var(--wp--custom--button--border--radius)",
"color": "var(--wp--custom--button--border--color)",
"style": "var(--wp--custom--button--border--style)",
"width": "var(--wp--custom--button--border--width)"
},
"color": {
"background": "var(--wp--custom--button--color--background)",
Expand All @@ -412,6 +433,14 @@
"fontSize": "var(--wp--custom--button--typography--font-size)",
"fontWeight": "var(--wp--custom--button--typography--font-weight)",
"lineHeight": "var(--wp--custom--button--typography--line-height)"
},
"spacing": {
"padding": {
"top": "var(--wp--custom--button--spacing--padding--top)",
"bottom": "var(--wp--custom--button--spacing--padding--bottom)",
"left": "var(--wp--custom--button--spacing--padding--left)",
"right": "var(--wp--custom--button--spacing--padding--right)"
}
}
},
"core/code": {
Expand Down
21 changes: 0 additions & 21 deletions geologist-blue/assets/theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading