Skip to content

Commit

Permalink
New "canard" button (#758)
Browse files Browse the repository at this point in the history
An additional colour for the buttons, based on the graphic charter of the EPFL; red is sometimes perceived as "too aggressive".

Co-authored-by: Aline <[email protected]>
  • Loading branch information
xentenza and alinekeller authored Oct 31, 2024
1 parent faee679 commit 41eb556
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 8 deletions.
4 changes: 4 additions & 0 deletions assets/components/atoms/button/button-tertiary-states.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<button class="btn btn-tertiary hover">Tertiary hover</button>
<button class="btn btn-tertiary active">Tertiary active</button>
<button class="btn btn-tertiary focus">Tertiary focus</button>
<button class="btn btn-tertiary" disabled>Tertiary disabled</button>
1 change: 1 addition & 0 deletions assets/components/atoms/button/button-tertiary.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<button class="btn btn-tertiary">Tertiary action</button>
41 changes: 41 additions & 0 deletions assets/components/atoms/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,47 @@ input[type="button"] {
}
}

.btn-tertiary {
background: $canard;
font-weight: $font-weight-bold;
color: $white;

&:hover,
&.hover {
background: $canard-dark;
border-color: $canard-dark;
color: $white;
}

&:focus,
&:focus-visible,
&.focus {
outline-color: $canard-dark !important;
color: $white;
}

&:not(:disabled):not(.disabled):active,
&:not(:disabled):not(.disabled).active {
// ugly ↓
// background: linear-gradient(to bottom, $canard-dark 0%, $red 100%);
background: color.adjust($canard-dark, $lightness: -10%);
border-color: color.adjust($canard-dark, $lightness: -10%);
}

&:disabled,
&.disabled {
background: $gray-100;
border-color: $gray-300;
color: $gray-300;

.bg-dark & {
background: $black;
border-color: $gray-600;
color: $gray-600;
}
}
}

.btn-light {
&,
&:hover {
Expand Down
8 changes: 8 additions & 0 deletions assets/components/atoms/button/button.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ variants:
title: Secondary states preview
notes: |
*For previewing purposes only. **Do not use in production!***
- name: tertiary
title: Button tertiary
notes: |
For less aggressive buttons that are still in line with the EPFL graphic charter.
- name: tertiary-states
title: Tertiary states preview
notes: |
*For previewing purposes only. **Do not use in production!***
notes: |
Button is your interaction friend when you want people to complete an action. By clicking a button, people expect to trigger an event, confirm a form or load a new page. Don't put many buttons on one single page. The primary action should be obvious for people.
Expand Down
17 changes: 10 additions & 7 deletions assets/config/bootstrap-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
//

// stylelint-disable
$white: #fff !default;
$gray-100: #e6e6e6 !default;
$gray-200: #d5d5d5 !default;
$gray-300: #c1c1c1 !default;
$gray-500: #8e8e8e !default;
$gray-600: #707070 !default;
$black: #212121 !default;
$white: #fff !default;
$gray-100: #e6e6e6 !default;
$gray-200: #d5d5d5 !default;
$gray-300: #c1c1c1 !default;
$gray-500: #8e8e8e !default;
$gray-600: #707070 !default;
$black: #212121 !default;
$leman: #00A79F !default;
$canard: #007480 !default;
$canard-dark: #004248 !default;

$grays: () !default;
$grays: map-merge((
Expand Down
3 changes: 2 additions & 1 deletion assets/config/colors.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"$gray-600": "#707070",
"$black": "#212121",
"$leman": "#00A79F",
"$canard": "#007480"
"$canard": "#007480",
"$canard-dark": "#004248"
}

0 comments on commit 41eb556

Please sign in to comment.