Skip to content

chore(ActionList): Remove the CSS modules feature flag from the ActionList.TrailingAction component #6021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-weeks-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

Remove the CSS modules feature flag from the ActionList.TrailingAction component
61 changes: 11 additions & 50 deletions packages/react/src/ActionList/TrailingAction.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import React, {forwardRef} from 'react'
import Box from '../Box'
import {Button, IconButton} from '../Button'
import type {ForwardRefComponent as PolymorphicForwardRefComponent} from '../utils/polymorphic'
import {clsx} from 'clsx'
import {useFeatureFlag} from '../FeatureFlags'
import classes from './ActionList.module.css'
import {actionListCssModulesFlag} from './featureflag'

type ElementProps =
| {
Expand All @@ -25,50 +22,8 @@ export type ActionListTrailingActionProps = ElementProps & {

export const TrailingAction = forwardRef(
({as = 'button', icon, label, href = null, className, ...props}, forwardedRef) => {
const enabled = useFeatureFlag(actionListCssModulesFlag)

if (enabled) {
return (
<span className={clsx(className, classes.TrailingAction)}>
{icon ? (
<IconButton
as={as}
aria-label={label}
icon={icon}
variant="invisible"
tooltipDirection="w"
href={href}
// @ts-expect-error StyledButton wants both Anchor and Button refs
ref={forwardedRef}
className={classes.TrailingActionButton}
{...props}
/>
) : (
// @ts-expect-error shhh
<Button
variant="invisible"
as={as}
href={href}
ref={forwardedRef}
className={classes.TrailingActionButton}
{...props}
>
{label}
</Button>
)}
</span>
)
}

return (
<Box
as="span"
data-component="ActionList.TrailingAction"
sx={{
flexShrink: 0,
}}
className={className}
>
<span className={clsx(className, classes.TrailingAction)}>
{icon ? (
<IconButton
as={as}
Expand All @@ -79,17 +34,23 @@ export const TrailingAction = forwardRef(
href={href}
// @ts-expect-error StyledButton wants both Anchor and Button refs
ref={forwardedRef}
className={classes.TrailingActionButton}
{...props}
/>
) : (
// @ts-expect-error shhh
<Button variant="invisible" as={as} href={href} ref={forwardedRef} {...props}>
<Button
variant="invisible"
as={as}
href={href}
ref={forwardedRef}
className={classes.TrailingActionButton}
{...props}
>
{label}
</Button>
)}
</Box>
</span>
)
},
) as PolymorphicForwardRefComponent<'button' | 'a', ActionListTrailingActionProps>

TrailingAction.displayName = 'ActionList.TrailingAction'
Loading