Skip to content

Deprecate AvatarPair component - move to @primer/react/deprecated while maintaining backward compatibility #6468

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 10 commits into from
Aug 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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/metal-lamps-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a major if we're no longer exporting through the main entrypoint

Copy link
Contributor

@pksjce pksjce Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm major would be removing it from the codebase no? But I get it. How does this go into v38 then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot - Export AvatarPair from both deprecated and main package so that we don't make a breaking change. Merge latest into the PR before you do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added AvatarPair exports to both the main package and deprecated package to avoid breaking changes. The component is now available from both import paths:

  • import { AvatarPair } from '@primer/react' (with deprecation warning)
  • import { AvatarPair } from '@primer/react/deprecated' (with deprecation warning)

This allows existing users to continue using their current import path without breaking changes while still providing deprecation warnings. Commit: f527ee9

---

Deprecate AvatarPair component - move to @primer/react/deprecated
40 changes: 0 additions & 40 deletions e2e/components/AvatarPair.test.ts

This file was deleted.

6 changes: 1 addition & 5 deletions e2e/components/Skeletons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ const stories = [
id: 'components-skeleton-skeletonavatar-features--in-a-stack',
disableAnimations: true,
},
{
title: 'SkeletonAvatar In An Avatar Pair',
id: 'components-skeleton-skeletonavatar-features--in-an-avatar-pair',
disableAnimations: true,
},

{
title: 'SkeletonAvatar Size',
id: 'components-skeleton-skeletonavatar-features--size',
Expand Down
3 changes: 0 additions & 3 deletions packages/react/src/SkeletonAvatar/SkeletonAvatar.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
},
{
"id": "components-skeleton-skeletonavatar-features--in-a-stack"
},
{
"id": "components-skeleton-skeletonavatar-features--in-an-avatar-pair"
}
],
"importPath": "@primer/react/experimental",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type {Meta} from '@storybook/react-vite'
import type {ComponentProps} from '../utils/types'
import {SkeletonAvatar} from './SkeletonAvatar'
import AvatarStack from '../AvatarStack'
import AvatarPair from '../AvatarPair'

export default {
title: 'Components/Skeleton/SkeletonAvatar/Features',
Expand Down Expand Up @@ -51,10 +50,3 @@ export const InAStack = () => (
<SkeletonAvatar />
</AvatarStack>
)

export const InAnAvatarPair = () => (
<AvatarPair>
<SkeletonAvatar />
<SkeletonAvatar />
</AvatarPair>
)
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ exports[`@primer/react/deprecated > should not update exports without a semver c
"type ActionListProps",
"ActionMenu",
"type ActionMenuProps",
"AvatarPair",
"type AvatarPairProps",
"Dialog",
"type DialogHeaderProps",
"type DialogProps",
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/__tests__/storybook.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const allowlist = [
'Autocomplete',
'Avatar',
'AvatarStack',
'AvatarPair',
'Breadcrumbs',
'BranchName',
'Blankslate',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {Meta} from '@storybook/react-vite'
import AvatarPair from './AvatarPair'
import Avatar from '../Avatar'
import Avatar from '../../Avatar'

export default {
title: 'Components/AvatarPair/Features',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {AvatarPair} from '../../src'
import AvatarPair from './AvatarPair'
import figma from '@figma/code-connect'

figma.connect(AvatarPair, 'https://www.figma.com/design/GCvY3Qv8czRgZgvl1dG6lp/Primer-Web?node-id=13006-42855', {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {Meta} from '@storybook/react-vite'
import AvatarPair from './AvatarPair'
import Avatar from '../Avatar'
import Avatar from '../../Avatar'

export default {
title: 'Components/AvatarPair',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import React, {type HTMLProps} from 'react'
import type {AvatarProps} from '../Avatar'
import Avatar from '../Avatar'
import {SkeletonAvatar} from '../SkeletonAvatar'
import type {AvatarProps} from '../../Avatar'
import Avatar from '../../Avatar'
import {SkeletonAvatar} from '../../SkeletonAvatar'
import classes from './AvatarPair.module.css'
import {clsx} from 'clsx'

/**
* @deprecated AvatarPair is deprecated. Please see https://github.com/github/primer/issues/5533 for migration guidance.
*/
export type AvatarPairProps = HTMLProps<HTMLDivElement>

/**
* @deprecated AvatarPair is deprecated. Please see https://github.com/github/primer/issues/5533 for migration guidance.
*/
const AvatarPair = ({children, className, ...rest}: AvatarPairProps) => {
const avatars = React.Children.map(children, (child, i) => {
if (!React.isValidElement(child)) {
Expand Down
5 changes: 5 additions & 0 deletions packages/react/src/deprecated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ export type {TabNavProps, TabNavLinkProps} from '../TabNav'
export {default as Tooltip} from '../Tooltip/Tooltip'
export type {TooltipProps} from '../Tooltip/Tooltip'
// end of v37.0.0

// Deprecated in v37.31.0 - https://github.com/github/primer/issues/5533
export {default as AvatarPair} from './AvatarPair'
export type {AvatarPairProps} from './AvatarPair'
// end of v37.31.0
5 changes: 3 additions & 2 deletions packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ export {default as Autocomplete} from './Autocomplete'
export type {AutocompleteMenuProps, AutocompleteInputProps, AutocompleteOverlayProps} from './Autocomplete'
export {default as Avatar} from './Avatar'
export type {AvatarProps} from './Avatar'
export {default as AvatarPair} from './AvatarPair'
export type {AvatarPairProps} from './AvatarPair'
export {default as AvatarStack} from './AvatarStack'
export type {AvatarStackProps} from './AvatarStack'
// AvatarPair is deprecated. Use Avatar component instead. See https://github.com/github/primer/issues/5533
export {default as AvatarPair} from './deprecated/AvatarPair'
export type {AvatarPairProps} from './deprecated/AvatarPair'
export {default as BranchName} from './BranchName'
export type {BranchNameProps} from './BranchName'
export {default as Breadcrumbs, Breadcrumb} from './Breadcrumbs'
Expand Down
20 changes: 1 addition & 19 deletions script/generate-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,25 +184,7 @@ const components = new Map([
],
},
],
[
'AvatarPair',
{
stories: [
{
id: 'components-avatarpair--default',
name: 'Default',
},
{
id: 'components-avatarpair-features--parent-circle',
name: 'Parent Circle',
},
{
id: 'components-avatarpair-features--parent-square',
name: 'Parent Square',
},
],
},
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do this now or when we remove the component?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the AvatarPair entry from the e2e test generation script as part of deprecation since we're removing all internal usage. This helps maintain consistency - the component is deprecated and should not have new e2e tests generated. Commit: 3b760cb


[
'BranchName',
{
Expand Down
Loading