Skip to content

Commit

Permalink
chore(Skeleton): Move Skeleton component from team to staff flag (#5289)
Browse files Browse the repository at this point in the history
* Move Skeleton component to staff feature flag

* Create old-weeks-matter.md
  • Loading branch information
jonrohan authored Nov 14, 2024
1 parent 8fd0035 commit cc876d9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-weeks-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Move Skeleton component from team to staff flag
1 change: 1 addition & 0 deletions packages/react/src/experimental/Skeleton/FeatureFlag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CSS_MODULE_FLAG = 'primer_react_css_modules_staff'
3 changes: 2 additions & 1 deletion packages/react/src/experimental/Skeleton/SkeletonAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import classes from './SkeletonAvatar.module.css'
import {clsx} from 'clsx'
import {useFeatureFlag} from '../../FeatureFlags'
import {merge} from '../../sx'
import {CSS_MODULE_FLAG} from './FeatureFlag'

export type SkeletonAvatarProps = Pick<AvatarProps, 'size' | 'square'> & {
/** Class name for custom styling */
Expand Down Expand Up @@ -39,7 +40,7 @@ export const SkeletonAvatar: React.FC<SkeletonAvatarProps> = ({
}) => {
const responsive = isResponsiveValue(size)
const cssSizeVars = {} as Record<string, string>
const enabled = useFeatureFlag('primer_react_css_modules_team')
const enabled = useFeatureFlag(CSS_MODULE_FLAG)
const avatarSx = responsive
? {
...getBreakpointDeclarations(
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/experimental/Skeleton/SkeletonBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {toggleStyledComponent} from '../../internal/utils/toggleStyledComponent'
import {clsx} from 'clsx'
import classes from './SkeletonBox.module.css'
import {useFeatureFlag} from '../../FeatureFlags'
import {CSS_MODULE_FLAG} from './FeatureFlag'

type SkeletonBoxProps = {
/** Height of the skeleton "box". Accepts any valid CSS `height` value. */
Expand All @@ -22,10 +23,9 @@ const shimmer = keyframes`
from { mask-position: 200%; }
to { mask-position: 0%; }
`
const CSS_MODULES_FEATURE_FLAG = 'primer_react_css_modules_team'

const StyledSkeletonBox = toggleStyledComponent(
CSS_MODULES_FEATURE_FLAG,
CSS_MODULE_FLAG,
'div',
styled.div<SkeletonBoxProps>`
animation: ${shimmer};
Expand Down Expand Up @@ -56,7 +56,7 @@ export const SkeletonBox = React.forwardRef<HTMLDivElement, SkeletonBoxProps>(fu
{height, width, className, style, ...props},
ref,
) {
const enabled = useFeatureFlag(CSS_MODULES_FEATURE_FLAG)
const enabled = useFeatureFlag(CSS_MODULE_FLAG)
return (
<StyledSkeletonBox
height={enabled ? undefined : height}
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/experimental/Skeleton/SkeletonText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import classes from './SkeletonText.module.css'
import {useFeatureFlag} from '../../FeatureFlags'
import {clsx} from 'clsx'
import {merge} from '../../sx'
import {CSS_MODULE_FLAG} from './FeatureFlag'

type SkeletonTextProps = {
/** Size of the text that the skeleton is replacing. */
Expand Down Expand Up @@ -80,7 +81,7 @@ export const SkeletonText: React.FC<SkeletonTextProps> = ({
style,
...rest
}) => {
const enabled = useFeatureFlag('primer_react_css_modules_team')
const enabled = useFeatureFlag(CSS_MODULE_FLAG)

if (lines < 2) {
return (
Expand Down

0 comments on commit cc876d9

Please sign in to comment.