Skip to content

Commit a37d544

Browse files
chore(ActionList): Remove the CSS modules feature flag from the ActionList.TrailingAction component (#6021)
Co-authored-by: primer[bot] <119360173+primer[bot]@users.noreply.github.com>
1 parent 1f53127 commit a37d544

File tree

2 files changed

+16
-50
lines changed

2 files changed

+16
-50
lines changed

.changeset/quiet-weeks-play.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': minor
3+
---
4+
5+
Remove the CSS modules feature flag from the ActionList.TrailingAction component
Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import React, {forwardRef} from 'react'
2-
import Box from '../Box'
32
import {Button, IconButton} from '../Button'
43
import type {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic'
54
import {clsx} from 'clsx'
6-
import {useFeatureFlag} from '../FeatureFlags'
75
import classes from './ActionList.module.css'
8-
import {actionListCssModulesFlag} from './featureflag'
96

107
type ElementProps =
118
| {
@@ -25,50 +22,8 @@ export type ActionListTrailingActionProps = ElementProps & {
2522

2623
export const TrailingAction = forwardRef(
2724
({as = 'button', icon, label, href = null, className, ...props}, forwardedRef) => {
28-
const enabled = useFeatureFlag(actionListCssModulesFlag)
29-
30-
if (enabled) {
31-
return (
32-
<span className={clsx(className, classes.TrailingAction)}>
33-
{icon ? (
34-
<IconButton
35-
as={as}
36-
aria-label={label}
37-
icon={icon}
38-
variant="invisible"
39-
tooltipDirection="w"
40-
href={href}
41-
// @ts-expect-error StyledButton wants both Anchor and Button refs
42-
ref={forwardedRef}
43-
className={classes.TrailingActionButton}
44-
{...props}
45-
/>
46-
) : (
47-
// @ts-expect-error shhh
48-
<Button
49-
variant="invisible"
50-
as={as}
51-
href={href}
52-
ref={forwardedRef}
53-
className={classes.TrailingActionButton}
54-
{...props}
55-
>
56-
{label}
57-
</Button>
58-
)}
59-
</span>
60-
)
61-
}
62-
6325
return (
64-
<Box
65-
as="span"
66-
data-component="ActionList.TrailingAction"
67-
sx={{
68-
flexShrink: 0,
69-
}}
70-
className={className}
71-
>
26+
<span className={clsx(className, classes.TrailingAction)}>
7227
{icon ? (
7328
<IconButton
7429
as={as}
@@ -79,17 +34,23 @@ export const TrailingAction = forwardRef(
7934
href={href}
8035
// @ts-expect-error StyledButton wants both Anchor and Button refs
8136
ref={forwardedRef}
37+
className={classes.TrailingActionButton}
8238
{...props}
8339
/>
8440
) : (
8541
// @ts-expect-error shhh
86-
<Button variant="invisible" as={as} href={href} ref={forwardedRef} {...props}>
42+
<Button
43+
variant="invisible"
44+
as={as}
45+
href={href}
46+
ref={forwardedRef}
47+
className={classes.TrailingActionButton}
48+
{...props}
49+
>
8750
{label}
8851
</Button>
8952
)}
90-
</Box>
53+
</span>
9154
)
9255
},
9356
) as PolymorphicForwardRefComponent<'button' | 'a', ActionListTrailingActionProps>
94-
95-
TrailingAction.displayName = 'ActionList.TrailingAction'

0 commit comments

Comments
 (0)