304 lines
4.6 KiB
SCSS
304 lines
4.6 KiB
SCSS
/* stylelint-disable plugin/no-low-performance-animation-properties */
|
|
|
|
.root {
|
|
--percent: calc(var(--progress, 0.5) * 100%);
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
height: 2rem;
|
|
border-radius: 0.625rem;
|
|
|
|
background: var(--color-background-menu-separator);
|
|
}
|
|
|
|
.withBadge {
|
|
margin-top: 3rem;
|
|
}
|
|
|
|
.badgeContainer {
|
|
position: absolute;
|
|
top: -1.5rem;
|
|
right: 0;
|
|
left: 0;
|
|
transform: translate(calc(var(--shift-x) * 100% - 50%), -20px);
|
|
|
|
display: flex;
|
|
justify-content: center;
|
|
|
|
transition: transform 0.2s ease-in-out;
|
|
animation: slide-in 0.5s ease-in-out;
|
|
}
|
|
|
|
@keyframes slide-in {
|
|
from {
|
|
transform: translate(-50%, -20px);
|
|
}
|
|
|
|
to {
|
|
transform: translate(calc(var(--shift-x) * 100% - 50%), -20px);
|
|
}
|
|
}
|
|
|
|
.floating-badge-wrapper {
|
|
position: relative;
|
|
|
|
overflow: hidden;
|
|
|
|
height: 2.6875rem;
|
|
border-radius: 0.5rem;
|
|
|
|
animation: rotate-in 0.5s ease-in-out;
|
|
}
|
|
|
|
@keyframes rotate-in {
|
|
0% {
|
|
transform: rotate(0deg);
|
|
}
|
|
|
|
50% {
|
|
// Rotate more if progress is higher
|
|
transform: rotate(calc(-20deg * var(--progress)));
|
|
}
|
|
|
|
100% {
|
|
transform: rotate(0deg);
|
|
}
|
|
}
|
|
|
|
.floating-badge {
|
|
position: relative;
|
|
z-index: 1;
|
|
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
height: 2rem;
|
|
padding: 0.25rem 0.75rem;
|
|
border-radius: 1rem;
|
|
|
|
color: #ffffff;
|
|
|
|
background-color: #7E85FF;
|
|
|
|
transition: width 0.25s ease-in-out;
|
|
|
|
&.noTransition {
|
|
transition: none;
|
|
}
|
|
}
|
|
|
|
.floatingBadgeContent {
|
|
overflow: hidden;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
width: fit-content;
|
|
max-width: 20rem;
|
|
margin-inline: auto;
|
|
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.floating-badge-triangle {
|
|
position: absolute;
|
|
bottom: -4px;
|
|
|
|
display: inline-block;
|
|
|
|
color: #7E85FF;
|
|
|
|
transition: left 0.3s ease;
|
|
}
|
|
|
|
.floating-badge-icon {
|
|
margin-right: 0.25rem;
|
|
font-size: 1.25rem;
|
|
}
|
|
|
|
.floating-badge-value {
|
|
font-size: 16px;
|
|
font-weight: var(--font-weight-medium);
|
|
}
|
|
|
|
.left, .right {
|
|
position: absolute;
|
|
top: 0;
|
|
bottom: 0;
|
|
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
font-weight: var(--font-weight-medium);
|
|
|
|
opacity: 1;
|
|
|
|
transition: opacity 0.15s ease;
|
|
}
|
|
|
|
.left {
|
|
left: 0.75rem;
|
|
}
|
|
|
|
.right {
|
|
right: 0.75rem;
|
|
}
|
|
|
|
.progressWrapper {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
border-radius: 0.625rem;
|
|
}
|
|
|
|
.positiveLayer,
|
|
.positiveProgress {
|
|
--multiplier: calc(1 / var(--positive-progress) - 1);
|
|
|
|
position: absolute;
|
|
top: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
|
|
overflow: hidden;
|
|
|
|
width: calc(var(--positive-progress) * 100%);
|
|
|
|
background-image: var(--premium-gradient);
|
|
background-size: calc(1 / var(--positive-progress) * 100%) 100%;
|
|
|
|
transition: opacity 0.15s ease, width 0.2s, background-size 0.3s ease;
|
|
|
|
.left, .right {
|
|
color: white;
|
|
white-space: nowrap;
|
|
opacity: 1;
|
|
transition: opacity 0.15s ease;
|
|
}
|
|
|
|
.right {
|
|
right: calc(-100% * var(--multiplier) + 0.75rem);
|
|
}
|
|
}
|
|
|
|
.negativeLayer,
|
|
.negativeProgress {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
left: auto;
|
|
|
|
overflow: hidden;
|
|
|
|
width: calc(var(--negative-progress) * 100%);
|
|
|
|
background-color: var(--color-negative-progress);
|
|
background-image: none;
|
|
|
|
transition: opacity 0.15s, width 0.2s;
|
|
|
|
.left, .right {
|
|
color: white;
|
|
white-space: nowrap;
|
|
opacity: 1;
|
|
transition: opacity 0.15s ease;
|
|
}
|
|
|
|
.right {
|
|
right: 0.75rem;
|
|
}
|
|
|
|
.left {
|
|
right: calc(100% - 0.75rem);
|
|
left: auto;
|
|
transition: right 0.3s ease;
|
|
}
|
|
}
|
|
|
|
.primary {
|
|
.positiveLayer,
|
|
.positiveProgress {
|
|
background-color: var(--color-primary);
|
|
background-image: none;
|
|
}
|
|
|
|
.floating-badge {
|
|
background-color: var(--color-primary);
|
|
}
|
|
|
|
.floating-badge-triangle {
|
|
color: var(--color-primary);
|
|
}
|
|
}
|
|
|
|
.negative {
|
|
.floating-badge {
|
|
background-color: var(--color-negative-progress);
|
|
}
|
|
|
|
.floating-badge-triangle {
|
|
color: var(--color-negative-progress);
|
|
}
|
|
}
|
|
|
|
.transitioning {
|
|
.left,
|
|
.right {
|
|
opacity: 0;
|
|
}
|
|
}
|
|
|
|
.noTransition {
|
|
&.positiveProgress,
|
|
&.negativeProgress {
|
|
transition: opacity 0.15s !important;
|
|
}
|
|
}
|
|
|
|
.hidden {
|
|
opacity: 0 !important;
|
|
}
|
|
|
|
.cycling {
|
|
.badgeContainer {
|
|
transition-duration: var(--cycling-animation-badge-position);
|
|
}
|
|
|
|
.positiveProgress,
|
|
.negativeProgress {
|
|
transition: opacity 0.15s, width var(--cycling-animation-progress), background-size 0.3s;
|
|
}
|
|
}
|
|
|
|
.positiveLayer {
|
|
--positive-progress: var(--layer-progress);
|
|
|
|
z-index: 2;
|
|
opacity: 0;
|
|
|
|
&.show {
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
.negativeLayer {
|
|
--negative-progress: var(--layer-progress);
|
|
|
|
z-index: 2;
|
|
opacity: 0;
|
|
|
|
&.show {
|
|
opacity: 1;
|
|
}
|
|
}
|