Files
grecia/app/assets/stylesheets/milestones.scss
Javi Martín 8c5907a3fb Add percentage text to progress bars
Note we require extra <span> tags because the <progress> tag is an empty
tag (like <img>), and so it can't have ::before or ::after
pseudo-elements. There's a workaround for that, but currently it only
works on Chrome.

For some reason, the text seems to be slightly misaligned vertically in
all implementations I've tried. So the `top: -0.1rem` rule is a hack to
align it properly.
2019-01-24 17:34:04 +01:00

158 lines
2.6 KiB
SCSS

.tab-milestones .timeline ul {
margin-top: rem-calc(40);
position: relative;
}
.tab-milestones .progress-bars {
margin-top: $line-height / 2;
h5 {
font-size: rem-calc(25);
}
ul {
border-spacing: rem-calc(15) $line-height / 4;
display: table;
margin-top: $line-height / 2;
li {
display: table-row;
> * {
display: table-cell;
vertical-align: middle;
}
}
}
[data-text] {
display: block;
font-weight: bold;
position: relative;
&::after {
content: attr(data-text);
left: 0;
position: absolute;
text-align: right;
top: -0.1rem;
width: 100%;
}
}
progress {
$background-color: #fef0e2;
$progress-color: #fea230;
background-color: $background-color;
color: $progress-color;
&.primary {
width: 100%;
}
&::-webkit-progress-bar {
background-color: $background-color;
}
&::-webkit-progress-value {
background-color: $progress-color;
}
&::-moz-progress-bar {
background-color: $progress-color;
}
}
}
.tab-milestones .timeline li {
margin: 0 auto;
position: relative;
width: 0;
@include breakpoint(small only) {
width: 100%;
}
&::before {
background: $budget;
border-radius: rem-calc(20);
content: '';
height: rem-calc(20);
position: absolute;
top: 5px;
transform: translateX(-50%);
width: rem-calc(20);
z-index: 2;
}
&::after {
background: $light-gray;
bottom: 100%;
content: '';
height: 100%;
position: absolute;
top: 25px;
width: 1px;
z-index: 1;
}
.milestone-content {
padding: $line-height / 6 $line-height / 2;
position: relative;
@include breakpoint(medium) {
width: rem-calc(300);
}
@include breakpoint(large) {
width: rem-calc(450);
}
h3 {
margin-bottom: 0;
}
.milestone-date {
color: $text-medium;
font-size: $small-font-size;
}
}
&:nth-child(odd) {
.milestone-content {
text-align: right;
@include breakpoint(medium) {
margin-left: rem-calc(-315);
}
@include breakpoint(large) {
margin-left: rem-calc(-465);
}
@include breakpoint(small only) {
left: 15px;
text-align: left;
}
}
}
&:nth-child(even) {
.milestone-content {
left: 15px;
}
}
}
.milestone-status {
background: $budget;
border-radius: rem-calc(4);
color: #fff;
display: inline-block;
margin-top: $line-height / 6;
padding: $line-height / 4 $line-height / 2;
}