File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
frontend/src/components/Spinner Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { useMemo } from 'react'
22import { useTranslation } from 'react-i18next'
33import { BiLoader } from 'react-icons/bi'
44import {
5+ Box ,
56 Flex ,
67 FlexProps ,
78 Icon ,
@@ -30,6 +31,11 @@ interface SpinnerProps extends FlexProps {
3031 */
3132 label ?: string
3233
34+ /**
35+ * Custom spinner element. If not provided, a default spinner icon will be used.
36+ */
37+ element ?: JSX . Element
38+
3339 /**
3440 * Font size of the spinner.
3541 */
@@ -50,6 +56,7 @@ export const Spinner = ({
5056 color = 'inherit' ,
5157 label : userSpecifiedLabel ,
5258 fontSize = '1rem' ,
59+ element,
5360 ...flexProps
5461} : SpinnerProps ) : JSX . Element => {
5562 const { t } = useTranslation ( )
@@ -66,12 +73,16 @@ export const Spinner = ({
6673 return (
6774 < Flex color = { color } align = "center" { ...flexProps } >
6875 { label && < VisuallyHidden > { label } </ VisuallyHidden > }
69- < Icon
70- animation = { animation }
71- as = { BiLoader }
72- fontSize = { fontSize }
73- aria-label = "Spinner icon"
74- />
76+ { element ? (
77+ < Box animation = { animation } > { element } </ Box >
78+ ) : (
79+ < Icon
80+ animation = { animation }
81+ as = { BiLoader }
82+ fontSize = { fontSize }
83+ aria-label = "Spinner icon"
84+ />
85+ ) }
7586 </ Flex >
7687 )
7788}
You can’t perform that action at this time.
0 commit comments