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): added css for monochrome button #451

Open
wants to merge 11 commits into
base: SUI-65
Choose a base branch
from
1 change: 0 additions & 1 deletion assets/scss/shared-ui/_color-accessibility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@
}

// Icons.
[class*="sui-icon-"],
.sui-dialog-close {
&:before {
color: $accessible-dark !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,35 @@

// DIR: Right-to-Left.
// No need.

// DIR: Monochrome.
@include body-class($wrap: true, $rtl: false, $monochrome: true) {

@include block($block) {

// Build text button.
@include sui-button--tool.button-theme-constructor(default, sui-button--palette.$button-theme-text-mono);

// // Build solid button.
@include sui-button--tool.button-theme-constructor(modifier, sui-button--palette.$button-theme-solid-mono, 'solid');

// Build light button.
@include sui-button--tool.button-theme-constructor(modifier, sui-button--palette.$button-theme-light-mono, 'light');

// // Build ghost button.
@include sui-button--tool.button-theme-constructor(modifier, sui-button--palette.$button-theme-ghost-mono, 'ghost');
}

// Disabled container.
*[disabled],
*:disabled,
*.disabled {

@include block($block) {

// Set disabled button styles.
@include sui-button--tool.button-theme-constructor(disabled-container, sui-button--palette.$button-theme-text-mono);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,43 @@ $button-theme-ghost: (
color: color.$white
)
),
);
);

// mono color styling for buttons
$button-theme-ghost-mono: (
'grey': (
static: (
border: color.$black,
background: color.$white,
color: color.$black
),
),
'blue': (
static: (
border: color.$black,
background: color.$white,
color: color.$black
),
),
'red': (
static: (
border: color.$black,
background: color.$white,
color: color.$black
),
),
'purple': (
static: (
border: color.$black,
background: color.$white,
color: color.$black
),
),
'green': (
static: (
border: color.$black,
background: color.$white,
color: color.$black
),
),
);
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,43 @@ $button-theme-light: (
color: color.$white
)
),
);

// mono color styling for buttons
$button-theme-light-mono: (
'grey': (
static: (
border: color.$smoke,
background: color.$smoke,
color: color.$black
),
),
'blue': (
static: (
border: color.$smoke,
background: color.$smoke,
color: color.$black
),
),
'red': (
static: (
border: color.$smoke,
background: color.$smoke,
color: color.$black
),
),
'purple': (
static: (
border: color.$smoke,
background: color.$smoke,
color: color.$black
),
),
'green': (
static: (
border: color.$smoke,
background: color.$smoke,
color: color.$black
),
),
);
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,43 @@ $button-theme-solid: (
background: color.$green-dark
)
),
);
);

// mono color styling for buttons
$button-theme-solid-mono: (
'grey': (
static: (
border: color.$black,
background: color.$black,
color: color.$white
),
),
'blue': (
static: (
border: color.$black,
background: color.$black,
color: color.$white
),
),
'red': (
static: (
border: color.$black,
background: color.$black,
color: color.$white
),
),
'purple': (
static: (
border: color.$black,
background: color.$black,
color: color.$white
),
),
'green': (
static: (
border: color.$black,
background: color.$black,
color: color.$white
),
),
);
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,50 @@ $button-theme-text: (
background: color.$green-ghost
)
),
);
);

// mono color styling for buttons
$button-theme-text-mono: (
'grey': (
static: (
color: color.$black,
),
hover: (
border: color.$black,
background: color.$black,
color: color.$white,
box-shadow: 0px 0px 0px 2px color.$fiftyshades,
),
focus: (
background: color.$black,
color: color.$white,
border: color.$white,
box-shadow: 0px 0px 0px 3px color.$black,
),
disabled: (
border: color.$overcast,
background: color.$overcast,
color: color.$ironmike,
)
),
'blue': (
static: (
color: color.$black,
),
),
'red': (
static: (
color: color.$black,
),
),
'purple': (
static: (
color: color.$black,
),
),
'green': (
static: (
color: color.$black,
),
),
);
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@
@if map.has-key($palette, $colour, hover, color) {
color: map.get($palette, $colour, hover, color);
}
@if map.has-key($palette, $colour, hover, box-shadow) {
box-shadow: map.get($palette, $colour, hover, box-shadow);
}
}
}

Expand All @@ -194,6 +197,9 @@
@if map.has-key($palette, $colour, focus, color) {
color: map.get($palette, $colour, focus, color);
}
@if map.has-key($palette, $colour, focus, box-shadow) {
box-shadow: map.get($palette, $colour, focus, box-shadow);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion assets/scss/shared-ui/_sui-button/_sui-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ $block-name: button;
@include sui-button--modifier.button-size($block-name);
@include sui-button--modifier.button-design--type($block-name);
@include sui-button--modifier.button-design--color($block-name);
@include sui-button--modifier.button-state($block-name);
@include sui-button--modifier.button-state($block-name);
2 changes: 1 addition & 1 deletion page-buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ <h2 class="sui-box-title">Button Design</h2>
</button>
</div>
<div style="margin-bottom: 30px;">
<button class="sui-button sui-button--green sui-button--loading" disabled>
<button class="sui-button sui-button--solid-green sui-button--loading" disabled>
<span class="sui-button__label">Button</span>
<span class="sui-button__loader sui-icon-loader sui-loading sui-sm" aria-hidden="true"></span>
</button>
Expand Down