forked from cotag/orbicular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_orbicular.scss
149 lines (123 loc) · 4.25 KB
/
_orbicular.scss
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
// Don't rely on Compass
@mixin co-border-radius($radius) {
border-radius:$radius;
-webkit-border-radius:$radius;
-moz-border-radius:$radius;
}
@mixin co-transform($transform) {
-webkit-transform: $transform;
-moz-transform: $transform;
-ms-transform: $transform;
transform: $transform;
}
@mixin co-box-sizing($type) {
-webkit-box-sizing: $type;
-moz-box-sizing: $type;
box-sizing: $type;
}
// Use this mixin to add orbicular support to your css
@mixin orbicular(
$barColor: #50a6d3, // The completed progress
$barBg: #EEE, // The remaining progress
$barWidth: 8, // The bar width is defined as a percentage of the width of the circle
$contentBg: #2b383f, // The circle center
$fontSize: 8, // Content font-size as a percentage of the circle size
$fontColor: #FFF,
$transTime: 0.3s,
$transFunc: linear,
$shadow: ''
) {
// This is the width of the progress bar itself.
// NOT the size of the circle which is definded by it's parent element.
//
// The bar width is defined as a percentage of the width of the circle
// (% of parent element width).
$calculatedWidth: $barWidth / 100;
$contentWidth: (1 - (2 * $calculatedWidth));
$actualBarWidth: $calculatedWidth + em;
$actualFontSize: $fontSize / 100 + em;
// this is the core progress class
div.co-circle-progress {
position: relative;
width: 100%;
height: 1em;
@include co-box-sizing(border-box);
*, *:after, *:before {
@include co-box-sizing(border-box);
}
// Provides the bars background
background-color: $barBg;
@include co-border-radius(0.5em);
// Common traits of all the circles
&> div.co-circle, div.co-fill {
position:absolute;
top: 0;
left: 0;
width: 1em;
height: 1em;
background: transparent;
@include co-border-radius(0.5em);
-webkit-transition: -webkit-transform $transTime $transFunc;
-moz-transition: -moz-transform $transTime $transFunc;
-ms-transition: -ms-transform $transTime $transFunc;
-o-transition: -o-transform $transTime $transFunc;
transition: -webkit-transform $transTime $transFunc;
transition: transform $transTime $transFunc;
}
&> div.co-circle {
// Hides half of the circle
clip: rect(0px, 1em, 1em, 0.5em);
&> div.co-fill {
clip: rect(0em, 0.5em, 1em, 0em);
background-color: $barColor;
}
}
// Optional Shadow (developer to style)
&> div.co-shadow {
@if $shadow == '' {
display: none;
} @else {
box-shadow: $shadow inset;
}
position:absolute;
width: 1em;
height: 1em;
background: transparent;
@include co-border-radius(0.5em);
}
// Centering of the transcluded content by default
&> div.co-content {
position:absolute;
overflow: hidden;
height: $contentWidth + em;
width: $contentWidth + em;
margin-left: $actualBarWidth;
margin-top: $actualBarWidth;
background-color: $contentBg;
@include co-border-radius($contentWidth / 2 + em);
@if $shadow != '' {
box-shadow: $shadow;
}
&> div {
position: relative;
display: table;
width: 100%;
height: 100%;
&> div {
display: table-row;
width: 100%;
height: 100%;
&> div {
display: table-cell;
font-size: $actualFontSize;
color: $fontColor;
line-height: 1em;
text-align: center;
vertical-align: middle;
width: 100%;
}
}
}
}
}
} // END mixin