File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed
packages/react/src/Spinner Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @primer/react " : patch
3
+ ---
4
+
5
+ Update Spinner component to correctly use the ` size ` prop when both ` sx ` and ` size ` are provided
Original file line number Diff line number Diff line change @@ -7,4 +7,4 @@ export default {
7
7
component : Spinner ,
8
8
} as Meta < typeof Spinner >
9
9
10
- export const Default = ( ) => < Spinner sx = { { border : '1px solid red' } } />
10
+ export const Default = ( ) => < Spinner sx = { { border : '1px solid red' } } size = "small" />
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type {HTMLDataAttributes} from '../internal/internal-types'
6
6
import { useId } from '../hooks'
7
7
import { useFeatureFlag } from '../FeatureFlags'
8
8
import classes from './Spinner.module.css'
9
- import Box from '../Box '
9
+ import { clsx } from 'clsx '
10
10
11
11
const sizeMap = {
12
12
small : '16px' ,
@@ -87,17 +87,21 @@ const StyledComponentSpinner = styled(Spinner)`
87
87
${ sx }
88
88
`
89
89
90
- function StyledSpinner ( { sx, ...props } : SpinnerProps ) {
90
+ const StyledBaseSpinner = styled . div `
91
+ ${ sx }
92
+ `
93
+
94
+ function StyledSpinner ( { sx, className, ...props } : SpinnerProps ) {
91
95
const enabled = useFeatureFlag ( 'primer_react_css_modules_team' )
92
96
if ( enabled ) {
93
97
if ( sx ) {
94
- return < Box sx = { sx } as = { Spinner } className = { classes . SpinnerAnimation } { ...props } />
98
+ return < StyledBaseSpinner sx = { sx } as = { Spinner } className = { clsx ( className , classes . SpinnerAnimation ) } { ...props } />
95
99
}
96
100
97
- return < Spinner className = { classes . SpinnerAnimation } { ...props } />
101
+ return < Spinner className = { clsx ( className , classes . SpinnerAnimation ) } { ...props } />
98
102
}
99
103
100
- return < StyledComponentSpinner sx = { sx } { ...props } />
104
+ return < StyledComponentSpinner sx = { sx } className = { className } { ...props } />
101
105
}
102
106
103
107
StyledSpinner . displayName = 'Spinner'
You can’t perform that action at this time.
0 commit comments