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

Feature/button styles #47

Merged
merged 7 commits into from
Oct 24, 2022
Merged
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
8 changes: 5 additions & 3 deletions inc/block-styles.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Register block styles.
*/
function register() {
/*
// Lead Paragraph: paragraph with large, bold text.
register_block_style(
'core/paragraph',
Expand All @@ -20,13 +21,14 @@ function register() {
'style' => 'themescaffold-style',
)
);
*/

// Plain Button: button with only text, no background.
// Link Button: button with only text, no background.
register_block_style(
'core/button',
array(
'name' => 'plain',
'label' => 'Plain',
'name' => 'link',
'label' => 'Link',
'style' => 'themescaffold-style',
)
);
Expand Down
8 changes: 4 additions & 4 deletions src/scripts/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ registerBlockCollection( 'acf', {
* Client-side block style registrations
*/
( () => {
// Button "plain"
// Button "link"
/*
registerBlockStyle( 'core/button', {
name: 'plain',
label: 'Plain',
name: 'link',
label: 'Link',
style: 'theme-style',
} );
*/
Expand All @@ -46,5 +46,5 @@ registerBlockCollection( 'acf', {
* Client-side block style unregistrations must happen on domReady
*/
domReady( () => {
//unregisterBlockStyle( 'core/button', 'fill' );
//unregisterBlockStyle( 'core/button', 'outline' );
} );
26 changes: 6 additions & 20 deletions src/styles/base/elements/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,15 @@
// Element: buttons.
//

@use '../../tools/context';
@use "../../tools/context";
@use "../../utilities/buttons";

// Only include base button styles on front so we don't interfere with UI buttons in the editor.
@include context.is-front {
button,
input[type='button'],
input[type='reset'],
input[type='submit'] {
border: 1px solid;
border-color: red;
border-radius: 3px;
background: transparent;
color: red;
line-height: 1;
padding: 0.6em 1em 0.4em;

&:hover {
border-color: black;
}

&:active,
&:focus {
border-color: black;
}
input[type="button"],
input[type="reset"],
input[type="submit"] {
@extend %button-filled;
}
}
20 changes: 0 additions & 20 deletions src/styles/base/elements/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,4 @@
//

a {
color: blue;

&:visited {
color: blue;
}

&:hover,
&:focus,
&:active {
color: blue;
}

&:focus {
outline: thin dotted;
}

&:hover,
&:active {
outline: 0;
}
}
21 changes: 21 additions & 0 deletions src/styles/base/global/_colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Utility: colors
*/

@use "../../settings/theme";

// Color CSS vars.
$theme-colors: theme.get-map("theme-colors");
@each $color, $value in $theme-colors {
.has-#{$color}-color.has-#{$color}-color.has-#{$color}-color {
color: #{theme.get-var("theme-colors", $color)};
--has-color: #{theme.get-var("theme-colors", $color)} !important;
}
.has-#{$color}-background-color.has-#{$color}-background-color.has-#{$color}-background-color {
background-color: #{theme.get-var("theme-colors", $color)};
--has-background-color: #{theme.get-var(
"theme-colors",
$color
)} !important;
}
}
23 changes: 23 additions & 0 deletions src/styles/blocks/core/_button.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// Block: core/button.
//

.wp-block-button {
$self: &;

&__link {
@extend %button-filled;
}

&.is-style-outline {
#{$self}__link {
@extend %button-outline;
}
}

&.is-style-link {
#{$self}__link {
@extend %button-link-arrow;
}
}
}
2 changes: 1 addition & 1 deletion src/styles/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
cursor: not-allowed;
pointer-events: none;
}
}
}
Loading