Skip to content

Commit

Permalink
fix(ARCH-720): Improve usage of info tokens and fix bootstrap button
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffroy Baccarini committed Aug 3, 2023
1 parent 372d85a commit 9f5cb43
Show file tree
Hide file tree
Showing 18 changed files with 177 additions and 209 deletions.
13 changes: 13 additions & 0 deletions .changeset/fresh-dolls-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@talend/design-system': patch
'@talend/bootstrap-sass': patch
'@talend/react-components': patch
'@talend/bootstrap-theme': patch
---

### Design System / Components / Bootstrap Theme
Improve usage of design tokens for info variants

### Bootstrap Theme
Fix some styling on buttons

221 changes: 95 additions & 126 deletions fork/bootstrap-sass/assets/stylesheets/bootstrap/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,167 +2,136 @@
// Buttons
// --------------------------------------------------


// Base styles
// --------------------------------------------------

.btn {
display: inline-block;
margin-bottom: 0; // For input.btn
font-weight: $btn-font-weight;
text-align: center;
white-space: nowrap;
vertical-align: middle;
touch-action: manipulation;
cursor: pointer;
background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
border: 1px solid transparent;
@include button-size($padding-base-vertical, $padding-base-horizontal, $font-size-base, $line-height-base, $btn-border-radius-base);
@include user-select(none);

&,
&:active,
&.active {
&:focus,
&.focus {
@include tab-focus;
}
}

&:hover,
&:focus,
&.focus {
color: $btn-default-color;
text-decoration: none;
}

&:active,
&.active {
background-image: none;
outline: 0;
@include box-shadow(inset 0 3px 5px rgba(0, 0, 0, .125));
}

&.disabled,
&[disabled],
fieldset[disabled] & {
cursor: $cursor-disabled;
@include opacity(.65);
@include box-shadow(none);
}

// [converter] extracted a& to a.btn
display: inline-block;
margin-bottom: 0; // For input.btn
font-weight: $btn-font-weight;
text-align: center;
white-space: nowrap;
vertical-align: middle;
touch-action: manipulation;
cursor: pointer;
background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
border: 1px solid transparent;
@include button-size($padding-base-vertical, $padding-base-horizontal, $font-size-base, $line-height-base, $btn-border-radius-base);
@include user-select(none);

&,
&:active,
&.active {
&:focus,
&.focus {
@include tab-focus;
}
}

&:hover,
&:focus,
&.focus {
color: $btn-default-color;
text-decoration: none;
}

&:active,
&.active {
background-image: none;
outline: 0;
@include box-shadow(inset 0 3px 5px rgba(0, 0, 0, 0.125));
}

&.disabled,
&[disabled],
fieldset[disabled] & {
cursor: $cursor-disabled;
@include opacity(0.65);
@include box-shadow(none);
}

// [converter] extracted a& to a.btn
}

a.btn {
&.disabled,
fieldset[disabled] & {
pointer-events: none; // Future-proof disabling of clicks on `<a>` elements
}
}


// Alternate buttons
// --------------------------------------------------

.btn-default {
@include button-variant($btn-default-color, $btn-default-bg, $btn-default-border);
}
.btn-primary {
@include button-variant($btn-primary-color, $btn-primary-bg, $btn-primary-border);
}
// Success appears as green
.btn-success {
@include button-variant($btn-success-color, $btn-success-bg, $btn-success-border);
}
// Info appears as blue-green
.btn-info {
@include button-variant($btn-info-color, $btn-info-bg, $btn-info-border);
}
// Warning appears as orange
.btn-warning {
@include button-variant($btn-warning-color, $btn-warning-bg, $btn-warning-border);
}
// Danger and error appear as red
.btn-danger {
@include button-variant($btn-danger-color, $btn-danger-bg, $btn-danger-border);
&.disabled,
fieldset[disabled] & {
pointer-events: none; // Future-proof disabling of clicks on `<a>` elements
}
}


// Link buttons
// -------------------------

// Make a button look and behave like a link
.btn-link {
font-weight: 400;
color: $link-color;
border-radius: 0;

&,
&:active,
&.active,
&[disabled],
fieldset[disabled] & {
background-color: transparent;
@include box-shadow(none);
}
&,
&:hover,
&:focus,
&:active {
border-color: transparent;
}
&:hover,
&:focus {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
background-color: transparent;
}
&[disabled],
fieldset[disabled] & {
&:hover,
&:focus {
color: $btn-link-disabled-color;
text-decoration: none;
}
}
font-weight: 400;
color: $link-color;
border-radius: 0;

&,
&:active,
&.active,
&[disabled],
fieldset[disabled] & {
background-color: transparent;
@include box-shadow(none);
}
&,
&:hover,
&:focus,
&:active {
border-color: transparent;
}
&:hover,
&:focus {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
background-color: transparent;
}
&[disabled],
fieldset[disabled] & {
&:hover,
&:focus {
color: $btn-link-disabled-color;
text-decoration: none;
}
}
}


// Button Sizes
// --------------------------------------------------

.btn-lg {
// line-height: ensure even-numbered height of button next to large input
@include button-size($padding-large-vertical, $padding-large-horizontal, $font-size-large, $line-height-large, $btn-border-radius-large);
// line-height: ensure even-numbered height of button next to large input
@include button-size($padding-large-vertical, $padding-large-horizontal, $font-size-large, $line-height-large, $btn-border-radius-large);
}
.btn-sm {
// line-height: ensure proper height of button next to small input
@include button-size($padding-small-vertical, $padding-small-horizontal, $font-size-small, $line-height-small, $btn-border-radius-small);
// line-height: ensure proper height of button next to small input
@include button-size($padding-small-vertical, $padding-small-horizontal, $font-size-small, $line-height-small, $btn-border-radius-small);
}
.btn-xs {
@include button-size($padding-xs-vertical, $padding-xs-horizontal, $font-size-small, $line-height-small, $btn-border-radius-small);
@include button-size($padding-xs-vertical, $padding-xs-horizontal, $font-size-small, $line-height-small, $btn-border-radius-small);
}


// Block button
// --------------------------------------------------

.btn-block {
display: block;
width: 100%;
display: block;
width: 100%;
}

// Vertically space out multiple block buttons
.btn-block + .btn-block {
margin-top: 5px;
margin-top: 5px;
}

// Specificity overrides
input[type="submit"],
input[type="reset"],
input[type="button"] {
&.btn-block {
width: 100%;
}
input[type='submit'],
input[type='reset'],
input[type='button'] {
&.btn-block {
width: 100%;
}
}
Original file line number Diff line number Diff line change
@@ -1,61 +1,7 @@
// Button variants
//
// Easily pump out default styles, as well as :hover, :focus, :active,
// and disabled options for all buttons

@mixin button-variant($color, $background, $border) {
color: $color;
background-color: $background;
border-color: $border;

&:focus,
&.focus {
color: $color;
background-color: darken($background, 10%);
border-color: darken($border, 25%);
}
&:hover {
color: $color;
background-color: darken($background, 10%);
border-color: darken($border, 12%);
}
&:active,
&.active,
.open > &.dropdown-toggle {
color: $color;
background-color: darken($background, 10%);
background-image: none;
border-color: darken($border, 12%);

&:hover,
&:focus,
&.focus {
color: $color;
background-color: darken($background, 17%);
border-color: darken($border, 25%);
}
}
&.disabled,
&[disabled],
fieldset[disabled] & {
&:hover,
&:focus,
&.focus {
background-color: $background;
border-color: $border;
}
}

.badge {
color: $background;
background-color: $color;
}
}

// Button sizes
@mixin button-size($padding-vertical, $padding-horizontal, $font-size, $line-height, $border-radius) {
padding: $padding-vertical $padding-horizontal;
font-size: $font-size;
line-height: $line-height;
border-radius: $border-radius;
padding: $padding-vertical $padding-horizontal;
font-size: $font-size;
line-height: $line-height;
border-radius: $border-radius;
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ $tc-collapsible-panel-padding-larger: $padding-larger !default;

&.info {
:global(.panel-heading) {
border-left-color: tokens.$coral-color-accent-text;
border-left-color: tokens.$coral-color-info-text;
}

:global(.tc-status-label) {
color: tokens.$coral-color-accent-text;
color: tokens.$coral-color-info-text;
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/Status/Status.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $tc-status-space-btn-icon-label: 5px !default;
}

&.info {
color: tokens.$coral-color-accent-icon;
color: tokens.$coral-color-info-icon;
}

&.success {
Expand All @@ -45,7 +45,7 @@ $tc-status-space-btn-icon-label: 5px !default;
font-weight: 600;

&.info {
color: tokens.$coral-color-accent-text;
color: tokens.$coral-color-info-text;
}

&.success {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

.information {
&_withBackground {
background-color: tokens.$coral-color-accent-background;
box-shadow: tokens.$coral-elevation-shadow-accent;
background-color: tokens.$coral-color-info-background;
box-shadow: tokens.$coral-elevation-shadow-info;
}

&__icon {
color: tokens.$coral-color-accent-icon;
color: tokens.$coral-color-info-icon;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use '~@talend/design-tokens/lib/tokens';

.information_border {
border-left-color: tokens.$coral-color-accent-icon;
border-left-color: tokens.$coral-color-info-icon;
}
Loading

0 comments on commit 9f5cb43

Please sign in to comment.