💄(frontend) clean up spinner styles
remove inline styles for better maintainability
This commit is contained in:
@@ -10,6 +10,7 @@ and this project adheres to
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- ♿️(frontend) improve spinner reduced‑motion fallback #931
|
||||||
- ♿️(frontend) fix form labels and autocomplete wiring #932
|
- ♿️(frontend) fix form labels and autocomplete wiring #932
|
||||||
- 🥅(summary) catch file-related exceptions when handling recording #944
|
- 🥅(summary) catch file-related exceptions when handling recording #944
|
||||||
- 📝(frontend) update legal terms #956
|
- 📝(frontend) update legal terms #956
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
import { ProgressBar } from 'react-aria-components'
|
import { ProgressBar } from 'react-aria-components'
|
||||||
import { css } from '@/styled-system/css'
|
import { RiHourglassFill } from '@remixicon/react'
|
||||||
|
import { css, cx } from '@/styled-system/css'
|
||||||
|
|
||||||
|
const rotatingArcClassName = css({
|
||||||
|
animation: 'rotate 1s ease-in-out infinite',
|
||||||
|
transformOrigin: 'center',
|
||||||
|
transition: 'transform 16ms linear',
|
||||||
|
})
|
||||||
|
|
||||||
export const Spinner = ({
|
export const Spinner = ({
|
||||||
size = 56,
|
size = 56,
|
||||||
@@ -44,37 +51,44 @@ export const Spinner = ({
|
|||||||
className={css({
|
className={css({
|
||||||
stroke: variant == 'light' ? 'primary.100' : 'transparent',
|
stroke: variant == 'light' ? 'primary.100' : 'transparent',
|
||||||
})}
|
})}
|
||||||
style={{}}
|
|
||||||
/>
|
/>
|
||||||
<circle
|
<circle
|
||||||
cx={center}
|
cx={center}
|
||||||
cy={center}
|
cy={center}
|
||||||
r={r}
|
r={r}
|
||||||
strokeDasharray={`${c} ${c}`}
|
strokeDasharray={`${c} ${c}`}
|
||||||
strokeDashoffset={percentage && c - (percentage / 100) * c}
|
strokeDashoffset={
|
||||||
|
typeof percentage === 'number'
|
||||||
|
? c - (percentage / 100) * c
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
strokeLinecap="round"
|
strokeLinecap="round"
|
||||||
className={css({
|
className={cx(
|
||||||
stroke: variant == 'light' ? 'primary.800' : 'white',
|
rotatingArcClassName,
|
||||||
})}
|
css({
|
||||||
style={{
|
stroke: variant == 'light' ? 'primary.800' : 'white',
|
||||||
animation: `rotate 1s ease-in-out infinite`,
|
})
|
||||||
transformOrigin: 'center',
|
)}
|
||||||
transition: 'transform 16ms linear',
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<span
|
<span
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
className={css({
|
className={css({
|
||||||
display: 'none',
|
display: 'none',
|
||||||
color: variant == 'light' ? 'primary.800' : 'white',
|
color: 'black',
|
||||||
fontSize: 'sm',
|
|
||||||
'@media (prefers-reduced-motion: reduce)': {
|
'@media (prefers-reduced-motion: reduce)': {
|
||||||
display: 'inline',
|
display: 'inline-flex',
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
⏳
|
<RiHourglassFill
|
||||||
|
size={Math.max(16, Math.round(size * 0.4))}
|
||||||
|
style={{
|
||||||
|
display: 'block',
|
||||||
|
transform: 'translateY(1px)',
|
||||||
|
color: variant == 'light' ? 'primary.800' : 'white',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user