Skip to content

Commit

Permalink
Remove CSS modules feature flag from Spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrohan committed Dec 19, 2024
1 parent 300c3b9 commit 6a9f45b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 149 deletions.
24 changes: 3 additions & 21 deletions packages/react/src/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import sx, {type SxProp} from '../sx'
import {VisuallyHidden} from '../VisuallyHidden'
import type {HTMLDataAttributes} from '../internal/internal-types'
import {useId} from '../hooks'
import {useFeatureFlag} from '../FeatureFlags'
import classes from './Spinner.module.css'
import {clsx} from 'clsx'

Expand Down Expand Up @@ -75,33 +74,16 @@ function Spinner({
)
}

const StyledComponentSpinner = styled(Spinner)`
@keyframes rotate-keyframes {
100% {
transform: rotate(360deg);
}
}
animation: rotate-keyframes 1s linear infinite;
${sx}
`

const StyledBaseSpinner = styled.div`
${sx}
`

function StyledSpinner({sx, className, ...props}: SpinnerProps) {
const enabled = useFeatureFlag('primer_react_css_modules_ga')
if (enabled) {
if (sx) {
return <StyledBaseSpinner sx={sx} as={Spinner} className={clsx(className, classes.SpinnerAnimation)} {...props} />
}

return <Spinner className={clsx(className, classes.SpinnerAnimation)} {...props} />
if (sx) {
return <StyledBaseSpinner sx={sx} as={Spinner} className={clsx(className, classes.SpinnerAnimation)} {...props} />
}

return <StyledComponentSpinner sx={sx} className={className} {...props} />
return <Spinner className={clsx(className, classes.SpinnerAnimation)} {...props} />
}

StyledSpinner.displayName = 'Spinner'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ exports[`snapshots renders a loading state 1`] = `
justify-content: center;
}
.c3:not(:focus):not(:active):not(:focus-within) {
.c2:not(:focus):not(:active):not(:focus-within) {
-webkit-clip-path: inset(50%);
clip-path: inset(50%);
height: 1px;
Expand All @@ -547,11 +547,6 @@ exports[`snapshots renders a loading state 1`] = `
width: 1px;
}
.c2 {
-webkit-animation: rotate-keyframes 1s linear infinite;
animation: rotate-keyframes 1s linear infinite;
}
.c0 {
position: absolute;
width: 1px;
Expand Down Expand Up @@ -582,7 +577,7 @@ exports[`snapshots renders a loading state 1`] = `
<svg
aria-hidden={true}
aria-labelledby=":r2h:"
className="c2"
className="SpinnerAnimation"
fill="none"
height="32px"
viewBox="0 0 16 16"
Expand All @@ -606,7 +601,7 @@ exports[`snapshots renders a loading state 1`] = `
/>
</svg>
<span
className="c3"
className="c2"
id=":r2h:"
>
Loading
Expand Down
Loading

0 comments on commit 6a9f45b

Please sign in to comment.