_progress.scss 4.02 KB
Newer Older
1
2
3
//
// Progress animations
//
4

Piotrek Okoński's avatar
Piotrek Okoński committed
5
@keyframes progress-bar-stripes {
Mark Otto's avatar
Mark Otto committed
6
  from  { background-position: $spacer-y 0; }
7
  to    { background-position: 0 0; }
8
9
10
}


11
12
13
//
// Basic progress bar
//
14

Piotrek Okoński's avatar
Piotrek Okoński committed
15
.progress {
16
17
  display: block;
  width: 100%;
Mark Otto's avatar
Mark Otto committed
18
19
  height: $spacer-y; // todo: make a new var for this
  margin-bottom: $spacer-y;
20
21
}
.progress[value] {
22
23
  // Set overall background
  background-color: #eee;
24
25
26
27
  // Remove Firefox and Opera border
  border: 0;
  // Reset the default appearance
  appearance: none;
28
29
30
31
  // Set overall border radius
  @include border-radius($border-radius);
}
.progress[value]::-ms-fill {
32
  background-color: $progress-bar-color;
33
34
  // Remove right-hand border of value bar from IE10+/Edge
  border: 0;
35
36
37
}
.progress[value]::-webkit-progress-bar {
  background-color: #eee;
38
  @include border-radius($border-radius);
Mark Otto's avatar
Mark Otto committed
39
  @include box-shadow(inset 0 .1rem .1rem rgba(0,0,0,.1));
40
41
}
.progress[value]::-webkit-progress-value {
42
  background-color: $progress-bar-color;
43
44
  border-top-left-radius: $border-radius;
  border-bottom-left-radius: $border-radius;
45
46
}
.progress[value="100"]::-webkit-progress-value {
47
48
  border-top-right-radius: $border-radius;
  border-bottom-right-radius: $border-radius;
49
50
}

51
// Firefox styles must be entirely separate or it busts Webkit styles.
Mark Otto's avatar
Mark Otto committed
52
53
54
//
// Commented out for now because linter.
//
Mark Otto's avatar
Mark Otto committed
55
// $-moz-document url-prefix() {
Mark Otto's avatar
Mark Otto committed
56
57
//   .progress[value] {
//     background-color: #eee;
58
//     .border-radius($border-radius);
Mark Otto's avatar
Mark Otto committed
59
60
61
//     .box-shadow(inset 0 .1rem .1rem rgba(0,0,0,.1));
//   }
//   .progress[value]::-moz-progress-bar {
62
//     background-color: $progress-bar-color;
63
64
//     border-top-left-radius: $border-radius;
//     border-bottom-left-radius: $border-radius;
Mark Otto's avatar
Mark Otto committed
65
66
//   }
//   .progress[value="0"]::-moz-progress-bar {
Mark Otto's avatar
Mark Otto committed
67
//     color: $gray-light;
Mark Otto's avatar
Mark Otto committed
68
69
70
71
72
//     min-width: 2rem;
//     background-color: transparent;
//     background-image: none;
//   }
//   .progress[value="100"]::-moz-progress-bar {
73
74
//     border-top-right-radius: $border-radius;
//     border-bottom-right-radius: $border-radius;
Mark Otto's avatar
Mark Otto committed
75
76
77
//   }
// }

78
// IE9 hacks to accompany custom markup. We don't need to scope this via media queries, but I feel better doing it anyway.
79
@media screen and (min-width:0\0) {
80
81
  .progress {
    background-color: #eee;
82
    @include border-radius($border-radius);
Mark Otto's avatar
Mark Otto committed
83
    @include box-shadow(inset 0 .1rem .1rem rgba(0,0,0,.1));
84
85
86
  }
  .progress-bar {
    display: inline-block;
Mark Otto's avatar
Mark Otto committed
87
    height: $spacer-y;
88
    text-indent: -999rem; // Simulate hiding of value as in native `<progress>`
89
    background-color: $progress-bar-color;
90
91
    border-top-left-radius: $border-radius;
    border-bottom-left-radius: $border-radius;
92
93
94
  }
  .progress[width^="0"] {
    min-width: 2rem;
95
    color: $gray-light;
96
97
98
99
    background-color: transparent;
    background-image: none;
  }
  .progress[width="100%"] {
100
101
    border-top-right-radius: $border-radius;
    border-bottom-right-radius: $border-radius;
102
103
104
105
  }
}


106
//
107
108
109
110
// Striped
//

.progress-striped[value]::-webkit-progress-value {
Mark Otto's avatar
Mark Otto committed
111
  @include gradient-striped();
Mark Otto's avatar
Mark Otto committed
112
  background-size: $spacer-y $spacer-y;
113
114
}
.progress-striped[value]::-moz-progress-bar {
Mark Otto's avatar
Mark Otto committed
115
  @include gradient-striped();
Mark Otto's avatar
Mark Otto committed
116
  background-size: $spacer-y $spacer-y;
117
}
118
119
120
121
.progress-striped[value]::-ms-fill {
  @include gradient-striped();
  background-size: $spacer-y $spacer-y;
}
122
// IE9
123
@media screen and (min-width:0\0) {
124
  .progress-bar-striped {
Mark Otto's avatar
Mark Otto committed
125
    @include gradient-striped();
Mark Otto's avatar
Mark Otto committed
126
    background-size: $spacer-y $spacer-y;
127
  }
128
129
}

130
131
132

//
// Animated
133
//
134
135

.progress-animated[value]::-webkit-progress-value {
136
  animation: progress-bar-stripes 2s linear infinite;
137
}
138
139
140
.progress-animated[value]::-moz-progress-bar {
  animation: progress-bar-stripes 2s linear infinite;
}
141
// IE9
142
@media screen and (min-width:0\0) {
143
144
  .progress-animated .progress-bar-striped {
    animation: progress-bar-stripes 2s linear infinite;
145
146
147
  }
}

148

149
//
Mark Otto's avatar
Mark Otto committed
150
// Variations
151
//
152

153
.progress-success {
Mark Otto's avatar
Mark Otto committed
154
  @include progress-variant($progress-bar-success-bg);
155
}
156
.progress-info {
Mark Otto's avatar
Mark Otto committed
157
  @include progress-variant($progress-bar-info-bg);
Mark Otto's avatar
Mark Otto committed
158
}
159
.progress-warning {
Mark Otto's avatar
Mark Otto committed
160
  @include progress-variant($progress-bar-warning-bg);
161
}
162
.progress-danger {
Mark Otto's avatar
Mark Otto committed
163
  @include progress-variant($progress-bar-danger-bg);
164
}