Skip to content
This repository was archived by the owner on Dec 11, 2021. It is now read-only.

Commit 4b2f1e9

Browse files
committed
Buttons: Adding Palette for example
1 parent 39c0b5b commit 4b2f1e9

File tree

7 files changed

+30
-15
lines changed

7 files changed

+30
-15
lines changed

scss/_utilities/_functions.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* ==========================================================================
3+
* Misc. Sass Functions to ease calculations
4+
* ==========================================================================
5+
*/
6+
7+
@function map-deep-get($map, $keys...) {
8+
$value: $map;
9+
@each $key in $keys {
10+
$value: map-get($value, $key);
11+
}
12+
@return $value;
13+
}

scss/atoms/buttons/_buttons.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
font-weight: map-get($ui-btn, font-weight);
1616
margin: map-get($ui-btn, margin);
1717
text-transform: map-get($ui-btn, text-transform);
18-
@include btn-colors($ui-btn-default);
18+
// @include btn-colors($ui-btn-default);
1919
@include btn-size($ui-btn-md);
2020
}
2121

scss/atoms/buttons/_mixins.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@mixin btn-colors($btn-colors) {
22
color: map-get($btn-colors, color);
3-
background: map-get($btn-colors, background);
3+
background: map-deep-get($btn-colors, "background", "base");
44
border-color: map-get($btn-colors, border);
55

66
&:active,
@@ -28,18 +28,18 @@
2828

2929
@mixin btn-active($btn-colors) {
3030
color: map-get($btn-colors, color);
31-
background: darken(map-get($btn-colors, background), 30%);
31+
background: map-deep-get($btn-colors, "background", "dark");
3232
border-color: map-get($btn-colors, border);
3333
}
3434

3535
@mixin btn-focus($btn-colors) {
3636
color: map-get($btn-colors, color);
37-
background: darken(map-get($btn-colors, background), 25%);
37+
background: map-deep-get($btn-colors, "background", "darker");
3838
border-color: map-get($btn-colors, border);
3939
}
4040

4141
@mixin btn-hover($btn-colors) {
4242
color: map-get($btn-colors, color);
43-
background: darken(map-get($btn-colors, background), 20%);
43+
background: map-deep-get($btn-colors, "background", "light");
4444
border-color: map-get($btn-colors, border);
4545
}

scss/lint.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
@import
1313
"_utilities/clearfix",
1414
"_utilities/colors",
15+
"_utilities/functions",
1516
"_utilities/hidden";
1617

1718
@import

scss/style.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
@import
66
"_utilities/clearfix",
7+
"_utilities/functions",
78
"_utilities/hidden";
89

910
@import

scss/variables/colors.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ chassis.colors = {
2020
},
2121
"success": {
2222
name: "Success Colors",
23-
values: {
23+
value: {
2424
"base": "#8BC34A",
2525
"light": "#9CCC65",
2626
"dark": "#8BC34A",
@@ -38,7 +38,7 @@ chassis.colors = {
3838
},
3939
"info": {
4040
name: "Info Colors",
41-
values: {
41+
value: {
4242
"base": "#00BCD4",
4343
"light": "#26C6DA",
4444
"dark": "#00ACC1",
@@ -47,7 +47,7 @@ chassis.colors = {
4747
},
4848
"error": {
4949
name: "Error Colors",
50-
values: {
50+
value: {
5151
"base": "#F44336",
5252
"light": "#EF5350",
5353
"dark": "#E53935",
@@ -56,14 +56,14 @@ chassis.colors = {
5656
},
5757
"text": {
5858
name: "Text Colors",
59-
values: {
59+
value: {
6060
"base": "#212121",
6161
"light": "#727272"
6262
}
6363
},
6464
"background": {
6565
name: "Background Colors",
66-
values: {
66+
value: {
6767
"base": "#fff"
6868
}
6969
}

scss/variables/z_buttons.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ chassis.uiButton = {
3333
name: "Primary Button",
3434
value: {
3535
"color": "#ffffff",
36-
"background": "#3F51B5",
36+
"background": "$primary",
3737
"border": "transparent"
3838
}
3939
},
4040
"ui-btn-success": {
4141
name: "Success Button",
4242
value: {
4343
"color": "#ffffff",
44-
"background": "#4CAF50",
44+
"background": "$success",
4545
"border": "transparent"
4646
}
4747
},
@@ -50,23 +50,23 @@ chassis.uiButton = {
5050
name: "Info Button",
5151
value: {
5252
"color": "#ffffff",
53-
"background": "#00BCD4",
53+
"background": "$info",
5454
"border": "transparent"
5555
}
5656
},
5757
"ui-btn-warning": {
5858
name: "Warning Button",
5959
value: {
6060
"color": "#ffffff",
61-
"background": "#FF5722",
61+
"background": "$warning",
6262
"border": "transparent"
6363
}
6464
},
6565
"ui-btn-danger": {
6666
name: "Danger Button",
6767
value: {
6868
"color": "#ffffff",
69-
"background": "#F44336",
69+
"background": "$error",
7070
"border": "transparent"
7171
}
7272
},

0 commit comments

Comments
 (0)