mirror of https://github.com/grafana/grafana
Chore: Enable `no-unreduced-motion` and fix errors (#86572)
* enable `no-unreduced-motion` in betterer * move all animation calls inside handleReducedMotion * fix violations + enable rule * update rule README * remove unnecessary transition from <Collapse> * remove handleReducedMotion utility and add handleMotion to theme * update to use new theme value * handle Dropdown and IconButton * handle AppChromeMenu and update lint message * keep rotation at a reduced speed * handle DashboardLoadingpull/87060/head
parent
8a1f43a65d
commit
c151a97110
@ -1,16 +0,0 @@ |
||||
import { CSSInterpolation } from '@emotion/css'; |
||||
|
||||
/** |
||||
* @param styles - Styles to apply when no `prefers-reduced-motion` preference is set. |
||||
* @param reducedMotionStyles - Styles to apply when `prefers-reduced-motion` is enabled. |
||||
* Applies one of `styles` or `reducedMotionStyles` depending on a users `prefers-reduced-motion` setting. Omitting `reducedMotionStyles` entirely will result in no styles being applied when `prefers-reduced-motion` is enabled. In most cases this is a reasonable default. |
||||
*/ |
||||
export const handleReducedMotion = (styles: CSSInterpolation, reducedMotionStyles?: CSSInterpolation) => { |
||||
const result: Record<string, CSSInterpolation> = { |
||||
'@media (prefers-reduced-motion: no-preference)': styles, |
||||
}; |
||||
if (reducedMotionStyles) { |
||||
result['@media (prefers-reduced-motion: reduce)'] = reducedMotionStyles; |
||||
} |
||||
return result; |
||||
}; |
Loading…
Reference in new issue