summaryrefslogtreecommitdiffstats
path: root/app/common/styles/base/buttons.scss
blob: 6337b33dbe2abdee671443063c59d6fda6a9f837 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
$btn-primary__bg: $base-01--03;
$btn-primary__bg--hover: $base-01--04;
$btn-primary__bg--disabled: $base-02--04;
$btn-primary__txt: $base-02--08;
$btn-primary__txt--disabled: $base-02--03;

$btn-secondary__bg: $base-02--08;
$btn-secondary__txt: $base-01--03;
$btn-secondary__txt--hover: $base-01--04;
$btn-secondary__txt--disabled: $base-02--03;

$btn-tertiary__bg: transparent;
$btn-tertiary__txt: $base-01--03;
$btn-tertiary__txt--hover: $base-01--04;
$btn-tertiary__txt--disabled: $base-02--03;

/***
Include .btn class in addition to the button type.
These styles provide structural and base properties
shared across all buttons. The additional button
type (.btn-primary, .btn-secondary) will provide color
properties
***/
button,
.btn,
[type='button'] {
  @include fontFamilyBold;
  @include fastTransition-all;
  border-style: solid;
  border-width: 2px;
  border-color: transparent;
  font-size: 1em;
  text-transform: none;
  border-radius: 0;
  padding: .5em 1em;
  line-height: 1;
  display: inline-block;
  cursor: pointer;
  &[disabled],
  &.disabled {
    opacity: 1;
    cursor: default;
  }
  &.full-width {
    width: 100%;
  }
  .icon,
  i {
    //button symbol
    font-style: normal;
    font-weight: normal;
    text-transform: none;
    display: inline-block;
    margin-right: 0.3em;
    vertical-align: bottom;
    margin-left: -0.5em;
  }
  img {
    width: 1.5em;
    height: 1.5em;
    display: inline-block;
    margin-right: 0.5em;
  }
  svg {
    height: 1.2em;
    width: auto;
    max-width: 100%;
  }
}

/***
Use for the primary use-case/s that is non-destructive.
e.g. directing to a new page, a call to action
***/
.btn-primary {
  background-color: $btn-primary__bg;
  border-color: $btn-primary__bg;
  color: $btn-primary__txt;
  &:hover {
    background-color: $btn-primary__bg--hover;
    border-color: $btn-primary__bg--hover;
  }
  &[disabled],
  &.disabled {
    background: $btn-primary__bg--disabled;
    border-color: $btn-primary__bg--disabled;
    color: $btn-primary__txt--disabled;
      .icon {
        fill: $btn-primary__txt--disabled;
      }
  }
  .icon {
    fill: $btn-primary__txt;
  }
}

/***
Secondary buttons are actions that fall secondary or
of less priority to primary buttons.
These usually come coupled with a primary.
***/
.btn-secondary {
  background-color: $btn-secondary__bg;
  border-color: $btn-secondary__txt;
  color: $btn-secondary__txt;
  &:hover {
    background-color: $btn-secondary__bg;
    border-color: $btn-secondary__txt--hover;
    color: $btn-secondary__txt--hover;
    .icon {
      fill: $btn-secondary__txt--hover;
    }
  }
  &[disabled],
  &.disabled {
    background-color: $btn-secondary__bg;
    border-color: $btn-secondary__txt--disabled;
    color: $btn-secondary__txt--disabled;
    .icon {
      fill: $btn-secondary__txt--disabled;
    }
  }
  .icon {
    fill: $btn-secondary__txt;
  }
}

/***
Tertiary text buttons are used to identify less pressing or
optional actions given on a page.
***/
.btn-tertiary {
  background-color: $btn-tertiary__bg;
  border-color: $btn-tertiary__bg;
  color: $btn-tertiary__txt;
  &:hover {
    color: $btn-tertiary__txt--hover;
    .icon {
      fill: $btn-tertiary__txt--hover;
    }
  }
  &[disabled],
  &.disabled {
    color: $btn-tertiary__txt--disabled;
    .icon {
      fill: $btn-tertiary__txt--disabled;
    }
  }
  .icon {
    fill: $btn-tertiary__txt;
  }
}

.btn-password-toggle {
  position: absolute;
  right: 0;
  margin-top: -34px;
  height: 32px;
  width: 52px;
  padding-top: 6px;
  padding-bottom: 6px;
  padding-right: 0;
  .icon {
    margin-right: 0;
  }
  &.password-visible {
    .icon {
      fill: $btn-tertiary__txt--disabled;
    }
  }
  &.password-hidden {
    .icon {
      // Adding tweaks to make sure the icons
      // are in the same place when toggling show/hide
      margin-right: 1px;
      width: 20px;
    }
  }
}
OpenPOWER on IntegriCloud