Skip to content

Commit 9d72fce

Browse files
committed
Refactor color variables into variables partial and effects into effects partial
1 parent 4efba2c commit 9d72fce

File tree

4 files changed

+35
-39
lines changed

4 files changed

+35
-39
lines changed

app/assets/stylesheets/partials/_effects.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44

55
// ANIMATION
66

7-
@mixin text-decoration-animation( $speed ) {
8-
transition: text-decoration #{$speed} ease;
7+
@mixin text-decoration-animation {
8+
transition: text-decoration 150ms ease;
99
text-decoration: none; // Included as fallback if text-decoration-color isn't supported
1010
text-decoration: underline transparent;
1111
}
1212

13+
@mixin hover-transition {
14+
transition: all .25s ease-in-out 0s;
15+
}
16+
1317
// OUTLINE
1418

1519
@mixin set-focus-outline() {

app/assets/stylesheets/partials/_header.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
color: $color-gray-300;
2424
font-size: 1.5rem;
2525
padding-top: 2px;
26-
@include text-decoration-animation(150ms);
26+
@include text-decoration-animation;
2727

2828
&:hover {
2929
text-decoration: underline;
@@ -61,7 +61,7 @@
6161
.platform-name {
6262
color: $color-white;
6363
font-size: 2.4rem;
64-
@include text-decoration-animation(150ms);
64+
@include text-decoration-animation;
6565

6666
&:hover {
6767
text-decoration: underline;
@@ -80,7 +80,7 @@
8080
color: $color-white;
8181
font-size: 1.8rem;
8282
font-weight: $fw-medium;
83-
@include text-decoration-animation(150ms);
83+
@include text-decoration-animation;
8484

8585
&:hover {
8686
text-decoration: underline;

app/assets/stylesheets/partials/_suggestion-panel.scss

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
1-
/* Color Variables */
2-
3-
// Core
4-
$blue-500: #0000FF;
5-
6-
$purple-700: #990099;
7-
8-
$white: #fff;
9-
$gray-100: #F2F2F2;
10-
$black: #111;
11-
12-
@mixin focus-outline {
13-
&:focus {
14-
outline: 3px solid $blue-500;
15-
}
16-
}
17-
18-
@mixin hover-transition {
19-
transition: all .25s ease-in-out 0s;
20-
}
21-
22-
// Semantic
23-
$color-suggestion-border: $purple-700;
24-
$color-suggestion-accent-text: $purple-700;
25-
26-
/* Suggestion Panel */
271
.mitlib-suggestion-panel {
282
border: 4px solid $color-suggestion-border;
293

@@ -69,25 +43,25 @@ $color-suggestion-accent-text: $purple-700;
6943
top: 0;
7044
right: 0;
7145

72-
background-color: $white;
46+
background-color: $color-white;
7347
border: none;
74-
color: $black;
48+
color: $color-text-primary;
7549
cursor: pointer;
7650
font-weight: 600;
7751

7852
@include hover-transition;
7953

80-
@include focus-outline;
54+
@include set-focus-outline;
8155

8256
&:hover {
83-
background-color: $gray-100;
57+
background-color: $color-gray-100;
8458
}
8559
}
8660
}
8761

8862
/* Button styles to be extracted into button component */
8963
.button.secondary {
90-
border: 1px solid $black;
64+
border: 1px solid $color-black;
9165
border-radius: 0;
9266
display: inline-block;
9367
padding: 6px 12px;
@@ -97,10 +71,10 @@ $color-suggestion-accent-text: $purple-700;
9771

9872
@include hover-transition;
9973

100-
@include focus-outline;
74+
@include set-focus-outline;
10175

10276
&:hover {
103-
color: $white;
104-
background-color: $black;
77+
color: $color-white;
78+
background-color: $color-black;
10579
}
10680
}

app/assets/stylesheets/partials/_variables.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
// #COLOR
33
// ----------------------------
44

5+
6+
57
// GRAY
8+
$color-gray-100: #F2F2F2;
69
$color-gray-200: #e6e6e6;
710
$color-gray-300: #ccc;
811
$color-gray-400: #b3b3b3;
@@ -20,18 +23,33 @@ $color-red-600: #e50000;
2023
$color-cyan-500: #00C8FF;
2124
$color-cyan-700: #00A0CC;
2225

26+
// BLUE
27+
$color-blue-500: #0000FF;
28+
29+
// PURPLE
30+
$color-purple-700: #990099;
31+
32+
33+
// ---------------
2334
// SEMANTIC COLORS
35+
2436
$color-black: #000;
2537
$color-white: #fff;
2638

39+
// TEXT
2740
$color-text-primary: $color-gray-950;
2841
$color-text-secondary: $color-gray-700;
2942
$color-text-placeholder: $color-gray-500;
3043
$color-text-disabled: $color-gray-400;
3144

45+
// FOCUS
3246
$color-focus: $color-cyan-700;
3347
$color-focus-dark: $color-cyan-500;
3448

49+
// SUGGESTION
50+
$color-suggestion-border: $color-purple-700;
51+
$color-suggestion-accent-text: $color-purple-700;
52+
3553
// ----------------------------
3654
// #TYPOGRAPHY
3755
// ----------------------------

0 commit comments

Comments
 (0)