2021-06-12 13:54:47 +00:00
|
|
|
/**
|
|
|
|
* Loading indicator
|
|
|
|
* Based on Vector
|
|
|
|
*
|
|
|
|
* By adding a class on the parent search form
|
|
|
|
* <div class=".citizen-loading"></div>
|
|
|
|
* A pseudo element is added via ':after' that adds the loading indicator.
|
|
|
|
*
|
|
|
|
* After appearing for more than a second, a progress-bar animation appears
|
|
|
|
* above the loading indicator.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
.citizen-loading:after {
|
2022-10-23 18:00:51 +00:00
|
|
|
// Delay animation by 500ms after loading
|
|
|
|
--delay-progress-bar: 500ms;
|
2021-06-12 13:54:47 +00:00
|
|
|
--height-progress-bar: @height-progress-bar;
|
|
|
|
z-index: 999;
|
|
|
|
display: block;
|
|
|
|
overflow: hidden;
|
|
|
|
width: 100%;
|
|
|
|
// Hide text in case it extends beyond the input.
|
|
|
|
height: var( --height-progress-bar );
|
|
|
|
// Ensure it doesn't extend beyond the input.
|
|
|
|
box-sizing: border-box;
|
2022-09-28 21:02:56 +00:00
|
|
|
// Align style with the form
|
|
|
|
border-radius: 0 0 var( --border-radius--large ) var( --border-radius--large );
|
2021-06-12 13:54:47 +00:00
|
|
|
// Animates the progress-bar.
|
|
|
|
animation: progress-bar
|
2022-09-29 23:12:56 +00:00
|
|
|
1200ms
|
|
|
|
linear
|
2022-10-23 18:00:51 +00:00
|
|
|
var( --delay-progress-bar )
|
2022-09-29 23:12:56 +00:00
|
|
|
infinite
|
|
|
|
alternate;
|
2022-10-23 18:00:51 +00:00
|
|
|
// Add a progress-bar to the loading indicator
|
2021-06-12 13:54:47 +00:00
|
|
|
background: /*image*/ linear-gradient( 90deg, var( --color-primary ) 0%, var( --color-primary ) 100% )
|
2022-09-29 23:12:56 +00:00
|
|
|
-10% 0 ~'/' 0 var( --height-progress-bar )
|
|
|
|
no-repeat,transparent;
|
2021-06-12 13:54:47 +00:00
|
|
|
// Placeholder text
|
|
|
|
content: 'loading';
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
@keyframes progress-bar {
|
|
|
|
0% {
|
|
|
|
background-position: -10% 0;
|
|
|
|
background-size: 0 var( --height-progress-bar );
|
|
|
|
}
|
|
|
|
|
|
|
|
30% {
|
|
|
|
background-position: -10% 0;
|
|
|
|
background-size: 30% var( --height-progress-bar );
|
|
|
|
}
|
|
|
|
|
|
|
|
70% {
|
|
|
|
background-position: 110% 0;
|
|
|
|
background-size: 30% var( --height-progress-bar );
|
|
|
|
}
|
|
|
|
|
|
|
|
100% {
|
|
|
|
background-position: 110% 0;
|
|
|
|
background-size: 0 var( --height-progress-bar );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// On page unload
|
|
|
|
html.citizen-loading:after {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
}
|
2022-10-23 18:00:51 +00:00
|
|
|
|
|
|
|
@media ( display-mode: standalone ) {
|
|
|
|
// Standalone PWA has no loading affordance
|
|
|
|
// So we provide one
|
|
|
|
html.citizen-loading:after {
|
|
|
|
--delay-progress-bar: 0ms;
|
|
|
|
}
|
|
|
|
}
|