UNPKG

2.67 kBSCSSView Raw
1// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
2// Licensed under the Apache License, Version 2.0.
3
4@import "../../common/variables";
5@import "common";
6
7/*
8Progress bars
9
10Markup:
11<div class="#{$ns}-progress-bar {{.modifier}}">
12 <div class="#{$ns}-progress-meter" style="width: 25%"></div>
13</div>
14<div class="#{$ns}-progress-bar #{$ns}-intent-primary {{.modifier}}">
15 <div class="#{$ns}-progress-meter" style="width: 50%"></div>
16</div>
17<div class="#{$ns}-progress-bar #{$ns}-intent-success {{.modifier}}">
18 <div class="#{$ns}-progress-meter" style="width: 75%"></div>
19</div>
20<div class="#{$ns}-progress-bar #{$ns}-intent-danger {{.modifier}}">
21 <div class="#{$ns}-progress-meter" style="width: 100%"></div>
22</div>
23
24.#{$ns}-no-stripes - No stripes
25.#{$ns}-no-animation - No animation
26
27Styleguide progress-bar
28*/
29
30$progress-bar-stripes-color: rgba($white, 0.2) !default;
31
32$progress-bar-height: round($pt-grid-size * 0.8) !default;
33$progress-bar-stripes-size: $pt-grid-size * 3 !default;
34$progress-bar-border-radius: $pt-grid-size * 4 !default;
35
36$progress-bar-gradient: linear-gradient(
37 -45deg,
38 $progress-bar-stripes-color 25%,
39 transparent 25%,
40 transparent 50%,
41 $progress-bar-stripes-color 50%,
42 $progress-bar-stripes-color 75%,
43 transparent 75%
44) !default;
45
46@keyframes linear-progress-bar-stripes {
47 from {
48 background-position: 0 0;
49 }
50
51 to {
52 background-position: $progress-bar-stripes-size 0;
53 }
54}
55
56.#{$ns}-progress-bar {
57 background: $progress-track-color;
58 border-radius: $progress-bar-border-radius;
59 display: block;
60 height: $progress-bar-height;
61 overflow: hidden;
62 position: relative;
63 width: 100%;
64
65 .#{$ns}-progress-meter {
66 background: $progress-bar-gradient;
67 background-color: $progress-head-color;
68 background-size: $progress-bar-stripes-size $progress-bar-stripes-size;
69 border-radius: $progress-bar-border-radius;
70 height: 100%;
71 position: absolute;
72 transition: width ($pt-transition-duration * 2) $pt-transition-ease;
73 // initial state is a full bar, a la "indeterminate"
74 width: 100%;
75 }
76
77 &:not(.#{$ns}-no-animation):not(.#{$ns}-no-stripes) .#{$ns}-progress-meter {
78 animation: linear-progress-bar-stripes ($pt-transition-duration * 3) linear infinite reverse;
79 }
80
81 &.#{$ns}-no-stripes .#{$ns}-progress-meter {
82 background-image: none;
83 }
84}
85
86.#{$ns}-dark .#{$ns}-progress-bar {
87 background: $dark-progress-track-color;
88
89 .#{$ns}-progress-meter {
90 background-color: $dark-progress-head-color;
91 }
92}
93
94@each $intent, $color in $pt-intent-colors {
95 .#{$ns}-progress-bar.#{$ns}-intent-#{$intent} .#{$ns}-progress-meter {
96 background-color: $color;
97 }
98}