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

fix: button: move three more button palettes to global css vars #593

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
88 changes: 53 additions & 35 deletions src/components/Button/button.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -745,27 +745,31 @@
}

.button-neutral {
--button-counter-default-text-color: var(--grey-color-80);
--button-counter-default-text-color: var(
--button-neutral-counter-default-text-color
);

--bg: var(--grey-color-10);
--color: var(--text-secondary-color);
--bg: var(--button-neutral-background-color);
--color: var(--button-neutral-text-color);
color: var(--color);
background-color: var(--bg);

&:hover:not([disabled]) {
--bg: var(--background-color);
--bg: var(--button-neutral-hover-background-color);
}

&:active:not([disabled]) {
--bg: var(--grey-color-20);
--bg: var(--button-neutral-active-background-color);
}
}

.button-system-ui {
--button-counter-default-text-color: var(--grey-color-80);
--button-counter-default-text-color: var(
--button-system-ui-counter-default-text-color
);

--bg: var(--background-color);
--color: var(--grey-color-60);
--bg: var(--button-system-ui-background-color);
--color: var(--button-system-ui-text-color);
color: var(--color);

.inner-nudge {
Expand Down Expand Up @@ -797,11 +801,11 @@
}

&:not(.transparent):not([disabled]):hover {
--bg: var(--grey-color-10);
--bg: var(--button-system-ui-hover-background-color);
}

&:not(.transparent):not([disabled]):active {
--bg: var(--grey-color-20);
--bg: var(--button-system-ui-active-background-color);
}
}

Expand Down Expand Up @@ -856,35 +860,35 @@
width: 1px;

&.split-divider-primary {
background-color: var(--primary-color-80);
background-color: var(--button-primary-split-divider-color);
}

&.split-divider-secondary {
background-color: var(--primary-color-70);
background-color: var(--button-secondary-split-divider-color);
}

&.split-divider-system-ui {
background-color: var(--grey-color-70);
background-color: var(--button-system-ui-split-divider-color);
}

&.split-divider-primary-disruptive {
background-color: var(--disruptive-color-80);
background-color: var(--button-primary-disruptive-split-divider-color);
}

&.split-divider-secondary-disruptive {
background-color: var(--disruptive-color-70);
background-color: var(--button-secondary-disruptive-split-divider-color);
}

&.split-divider-default {
background-color: var(--primary-color-70);
background-color: var(--button-default-split-divider-color);
}

&.split-divider-disruptive {
background-color: var(--disruptive-color-70);
background-color: var(--button-default-disruptive-split-divider-color);
}

&.split-divider-neutral {
background-color: var(--grey-color-70);
background-color: var(--button-neutral-split-divider-color);
}
}

Expand All @@ -908,15 +912,27 @@
}

.two-state-button {
--button-counter-default-background-color: var(--green-color-20);
--button-counter-hover-background-color: var(--green-color-20);
--button-counter-checked-background-color: var(--green-color-10);
--button-counter-focus-background-color: var(--green-color-20);
--button-counter-active-background-color: var(--green-color-10);
--button-counter-default-text-color: var(--grey-color-80);

--bg: var(--grey-color-10);
--color: var(--grey-color-70);
--button-counter-default-background-color: var(
--button-two-state-counter-default-background-color
);
--button-counter-hover-background-color: var(
--button-two-state-counter-hover-background-color
);
--button-counter-checked-background-color: var(
--button-two-state-counter-checked-background-color
);
--button-counter-focus-background-color: var(
--button-two-state-counter-focus-background-color
);
--button-counter-active-background-color: var(
--button-two-state-counter-active-background-color
);
--button-counter-default-text-color: var(
--button-two-state-counter-default-text-color
);

--bg: var(--button-two-state-background-color);
--color: var(--button-two-state-text-color);
background-color: var(--bg);
color: var(--color);

Expand Down Expand Up @@ -964,26 +980,26 @@
}

&:hover:not([disabled]) {
--bg: var(--green-color-10);
--color: var(--accent-color-70);
--bg: var(--button-two-state-hover-background-color);
--color: var(--button-two-state-hover-text-color);

.counter {
background-color: var(--button-counter-hover-background-color);
}
}

&:active:not([disabled]) {
--bg: var(--green-color-20);
--color: var(--accent-color);
--bg: var(--button-two-state-active-background-color);
--color: var(--button-two-state-active-text-color);

.counter {
background-color: var(--button-counter-active-background-color);
}
}

&.checked {
--bg: var(--green-color-20);
--color: var(--accent-color-80);
--bg: var(--button-two-state-checked-background-color);
--color: var(--button-two-state-checked-text-color);

.counter {
background-color: var(--button-counter-checked-background-color);
Expand Down Expand Up @@ -1284,7 +1300,7 @@
&.button-neutral {
&.focus-visible,
&:focus-visible {
background-color: var(--grey-color-10);
background-color: var(--button-neutral-focus-visible-background-color);

&.drop-shadow {
box-shadow: var(--focus-visible-box-shadow), $shadow-object-s;
Expand All @@ -1295,7 +1311,9 @@
&.button-system-ui {
&.focus-visible,
&:focus-visible {
background-color: var(--background-color);
background-color: var(
--button-system-ui-focus-visible-background-color
);

&.drop-shadow {
box-shadow: var(--focus-visible-box-shadow), $shadow-object-s;
Expand Down
44 changes: 44 additions & 0 deletions src/styles/themes/_default-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
--button-default-active-border-color: var(
--button-default-active-background-color
);
--button-default-split-divider-color: var(--primary-color-70);
// ------ Default Button theme ------

// ------ Default Disruptive Button theme ------
Expand Down Expand Up @@ -476,8 +477,19 @@
--button-default-disruptive-active-border-color: var(
--button-default-disruptive-active-background-color
);
--button-default-disruptive-split-divider-color: var(--disruptive-color-70);
// ------ Default Disruptive Button theme ------

// ------ Neutral Button theme ------
--button-neutral-text-color: var(--text-secondary-color);
--button-neutral-background-color: var(--grey-color-10);
--button-neutral-counter-default-text-color: var(--grey-color-80);
--button-neutral-hover-background-color: var(--background-color);
--button-neutral-focus-visible-background-color: var(--grey-color-10);
--button-neutral-active-background-color: var(--grey-color-20);
--button-neutral-split-divider-color: var(--grey-color-70);
// ------ Neutral Button theme ------

// ------ Primary Button theme ------
--button-primary-text-color: var(--primary-color-80);
--button-primary-background-color: var(--accent-color-20);
Expand All @@ -498,6 +510,7 @@
--button-primary-active-border-color: var(
--button-primary-active-background-color
);
--button-primary-split-divider-color: var(--primary-color-80);
// ------ Primary Button theme ------

// ------ Primary Disruptive Button theme ------
Expand Down Expand Up @@ -538,6 +551,7 @@
--button-primary-disruptive-active-border-color: var(
--button-primary-disruptive-active-background-color
);
--button-primary-disruptive-split-divider-color: var(--disruptive-color-80);
// ------ Primary Disruptive Button theme ------

// ------ Secondary Button theme ------
Expand All @@ -556,6 +570,7 @@
--button-secondary-active-border-width: var(--button-secondary-border-width);
--button-secondary-active-border-style: var(--button-secondary-border-style);
--button-secondary-active-border-color: var(--button-secondary-border-color);
--button-secondary-split-divider-color: var(--primary-color-70);
// ------ Secondary Button theme ------

// ------ Secondary Disruptive Button theme ------
Expand Down Expand Up @@ -594,8 +609,37 @@
--button-secondary-disruptive-active-border-color: var(
--button-secondary-disruptive-active-background-color
);
--button-secondary-disruptive-split-divider-color: var(--disruptive-color-70);
// ------ Secondary Disruptive Button theme ------

// ------ System UI Button theme ------
--button-system-ui-text-color: var(--grey-color-60);
--button-system-ui-background-color: var(--background-color);
--button-system-ui-counter-default-text-color: var(--grey-color-80);
--button-system-ui-hover-background-color: var(--grey-color-10);
dkilgore-eightfold marked this conversation as resolved.
Show resolved Hide resolved
--button-system-ui-focus-visible-background-color: var(--background-color);
--button-system-ui-active-background-color: var(--grey-color-20);
--button-system-ui-split-divider-color: var(--grey-color-70);
// ------ System UI Button theme ------

// ------ Two State Button theme ------
--button-two-state-text-color: var(--grey-color-70);
--button-two-state-background-color: var(--grey-color-10);
--button-two-state-border-color: var(--button-two-state-background-color);
--button-two-state-counter-default-background-color: var(--green-color-20);
--button-two-state-counter-hover-background-color: var(--green-color-20);
dkilgore-eightfold marked this conversation as resolved.
Show resolved Hide resolved
--button-two-state-counter-checked-background-color: var(--green-color-10);
--button-two-state-counter-focus-background-color: var(--green-color-20);
--button-two-state-counter-active-background-color: var(--green-color-10);
--button-two-state-counter-default-text-color: var(--grey-color-80);
--button-two-state-hover-text-color: var(--accent-color-70);
--button-two-state-hover-background-color: var(--green-color-10);
--button-two-state-active-text-color: var(--accent-color);
--button-two-state-active-background-color: var(--green-color-20);
--button-two-state-checked-text-color: var(--accent-color-80);
--button-two-state-checked-background-color: var(--green-color-20);
// ------ Two State Button theme ------

// ------ Button Counter theme ------
--button-counter-default-background-color: var(--grey-color-20);
--button-counter-hover-background-color: var(--grey-color-20);
Expand Down