mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
Chore: Use handleReducedMotion
to smooth the animation in LoadingBar
(#85808)
This commit is contained in:
parent
219c2c761e
commit
82f910c0c5
@ -4,6 +4,7 @@ import React, { CSSProperties } from 'react';
|
||||
import { GrafanaTheme2 } from '@grafana/data';
|
||||
|
||||
import { useStyles2 } from '../../themes';
|
||||
import { handleReducedMotion } from '../../utils/handleReducedMotion';
|
||||
|
||||
export interface LoadingBarProps {
|
||||
width: number;
|
||||
@ -52,10 +53,17 @@ const getStyles = (_theme: GrafanaTheme2, delay: number, duration: number) => {
|
||||
animationName: animation,
|
||||
// an initial delay to prevent the loader from showing if the response is faster than the delay
|
||||
animationDelay: `${delay}ms`,
|
||||
animationDuration: `${duration}ms`,
|
||||
animationTimingFunction: 'linear',
|
||||
animationIterationCount: 'infinite',
|
||||
willChange: 'transform',
|
||||
...handleReducedMotion(
|
||||
{
|
||||
animationDuration: `${duration}ms`,
|
||||
},
|
||||
{
|
||||
animationDuration: `${4 * duration}ms`,
|
||||
}
|
||||
),
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user