Summary Files Commits Branches @commit @diff @stats
path: root / src / buttons.less
blob: 6654c47008e2e976bc33734ef339bbdaa0478c96 (plain) (blame)
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
// Buttons
.btn,
button {
  display: inline-block;
  height: 3.2rem;
  padding: .7rem 1.5rem;
  border: .1rem solid @core-color;
  background-color: transparent;
  border-radius: 3px;
  color: @core-color;
  font-size: 1.4rem;
  line-height: 1.6rem;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-appearance: none;
  outline: 0;

  &:hover,
  &:focus {
    color: #fff;
    background-color: @core-color;
  }
  &:active,
  &.active {
    color: #fff;
    background-color: darken(@core-color, 5%);
  }

  &.loading {
    color: transparent !important;
    pointer-events: none;
    position: relative;

    &::after {
      border: 2px solid @core-color;
      border-right-color: transparent;
      border-top-color: transparent;
      border-radius: 8px;
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      margin-left: -8px;
      margin-top: -8px;
      display: block;
      width: 16px;
      height: 16px;
      animation: loading 500ms infinite linear;
    }
  }

  &[disabled] {
    opacity: .5;
    cursor: default;
  }

  // Button Primary
  &.btn-primary {
    color: #fff;
    border-color: @core-color;
    background-color: @core-color;

    &:hover,
    &:focus {
      color: #fff;
      border-color: darken(@core-color, 5%);
      background-color: darken(@core-color, 5%);
    }
    &:active,
    &.active {
      color: #fff;
      border-color: darken(@core-color, 10%);
      background-color: darken(@core-color, 10%);
    }

    &.loading {
      &::after {
        border-color: #fff;
        border-right-color: transparent;
        border-top-color: transparent;
      }
    }
  }

  // Button Link
  &.btn-link {
    color: @core-color;
    border-color: transparent;
    background-color: transparent;

    &:hover,
    &:focus {
      color: darken(@core-color, 15%);
    }
    &:active,
    &.active {
      color: darken(@core-color, 25%);
    }
  }

  // Button Small
  &.btn-sm {
    height: 2.4rem;
    border-radius: 2px;
    font-size: 1.2rem;
    line-height: 1.4rem;
    padding: .4rem 1rem;
  }

  // Button Large
  &.btn-lg {
    height: 4.2rem;
    border-radius: 4px;
    font-size: 1.8rem;
    line-height: 2rem;
    padding: 1rem 1.8rem;
  }

  // TODO: Button with icons
  // TODO: Button groups
}