summaryrefslogtreecommitdiff
path: root/_sass/common/classes/_clickable.scss
blob: af32effd602f6861abcde0dc412b188b6ea2c0a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
@mixin clickable($clr, $bg-clr, $hover-clr: default, $hover-bg-clr: default, $active-clr: default, $active-bg-clr: default, $focus-clr: default, $focus-bg-clr: default, $theme: default, $ignore-path: default) {

  @if $theme == default {
    @if $bg-clr == null and $hover-bg-clr == null {
      @if $hover-clr == default {
        $theme: get-color-theme($clr);
      } @else {
        $theme: get-color-theme($hover-clr);
      }
    } @else {
      @if $hover-bg-clr == default {
        $theme: get-color-theme($bg-clr);
      } @else {
        $theme: get-color-theme($hover-bg-clr);
      }
    }
  }

  @if $ignore-path == default {
    $ignore-path: false;
  } @else {
    $ignore-path: true;
  }

  @include transition(map-get($clickable, transition));
  @if $ignore-path == false {
    svg {
      path {
        @include transition(map-get($clickable, transition));
      }
    }
  }

  // hover
  @if $hover-clr == default {
    @if $hover-bg-clr == null {
      @if $theme == "light" {
        $hover-clr: darken($clr, 14%);
      }
      @if $theme == "dark" {
        $hover-clr: lighten($clr, 18%);
      }
    } @else if $hover-bg-clr == default {
      $hover-clr: $clr;
    }
  }

  @if $hover-bg-clr == default {
    @if $theme == "light" {
      $hover-bg-clr: darken($bg-clr, 14%);
    }
    @if $theme == "dark" {
      $hover-bg-clr: lighten($bg-clr, 18%);
    }
  }

  // active
  @if $active-clr == default {
    @if $active-bg-clr == null {
      @if $theme == "light" {
        $active-clr: darken($hover-clr, 15%);
      }
      @if $theme == "dark" {
        $active-clr: lighten($hover-clr, 16%);
      }
    } @else if $active-bg-clr == default {
      $active-clr: $hover-clr;
    }
  }

  @if $active-bg-clr == default {
    @if $theme == "light" {
      $active-bg-clr: darken($hover-bg-clr, 15%);
    }
    @if $theme == "dark" {
      $active-bg-clr: lighten($hover-bg-clr, 16%);
    }
  }

  // focus
  @if $focus-clr == default {
    @if $focus-bg-clr == null {
      $focus-clr: $hover-clr;
    } @else if $hover-bg-clr == default {
      $focus-clr: $hover-clr;
    }
  }

  @if $focus-bg-clr == default {
    $focus-bg-clr: $hover-bg-clr;
  }

  @include plain() {
    color: $clr;
    @if $bg-clr {
      background-color: $bg-clr;
    }
    @if $ignore-path == false {
      svg path {
        fill: $clr;
      }
    }
  }
  @include hover() {
    color: $hover-clr;
    @if $hover-bg-clr {
      background-color: $hover-bg-clr;
    }
    @if $ignore-path == false {
      svg path {
        fill: $hover-clr;
      }
    }
  }
  @include active() {
    color: $active-clr;
    @if $active-bg-clr {
      background-color: $active-bg-clr;
    }
    @if $ignore-path == false {
      svg path {
        fill: $active-clr;
      }
    }
  }
  @include focus() {
    color: $focus-clr;
    @if $focus-bg-clr{
      background-color: $focus-bg-clr;
      box-shadow: 0 0 0 2px rgba($focus-bg-clr, .4);
    }
    @if $ignore-path == false {
      svg path {
        fill: $focus-clr;
      }
    }
  }
  @include disabled() {
    @if $theme == "light" {
      color: rgba($clr, .2) !important;
    }
    @if $theme == "dark" {
      color: rgba($clr, .4) !important;
    }
    @if $bg-clr {
      background-color: $bg-clr !important;
    }
    @if $ignore-path == false {
      svg path {
        @if $theme == "light" {
          fill: rgba($clr, .2) !important;
        }
        @if $theme == "dark" {
          fill: rgba($clr, .4) !important;
        }
      }
    }
  }
}