Skip to content
Closed
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ node_modules

# Gatsby
public/
# Allow Storybook's static assets directory
!packages/react/.storybook/public/

# Storybook
storybook-static
Expand Down
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot instead of seeing the avatars of users, i now see primer's logo here for all stories :/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 70ef88f. Root causes were:

  1. Org logos were all identicalgithub.png, desktop.png, and facebook.png were byte-for-byte the same file as primer.png (all 5065-byte, 420×420 PNGs). They've been re-downloaded as their correct logos.

  2. User avatars were tiny thumbnails — all user JPEGs were 64×64 (1–2 KB). They've been re-downloaded at full resolution (400–460px, 18–287 KB), so each user now shows their actual profile photo.

  3. Dead VRT route mock removed — the page.route('https://github.com/*.png', ...) interceptor in storybook.ts that redirected all avatars to Primer's logo has been removed. Since no stories use external avatar URLs anymore, it was unreachable dead code (and was masking the image content issue in VRT runs).

VRT baselines were captured with the old incorrect images and will need to be regenerated — CI VRT will show diffs for the affected stories.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/react/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This file has been automatically migrated to valid ESM format by Storybook.
import {fileURLToPath} from 'node:url'
import {createRequire} from 'node:module'
import path from 'node:path'
import react from '@vitejs/plugin-react'
Expand All @@ -11,6 +12,8 @@ const require = createRequire(import.meta.url)
const {DEPLOY_ENV = 'development'} = process.env

const config: StorybookConfig = {
staticDirs: [path.join(path.dirname(fileURLToPath(import.meta.url)), 'public')],

stories:
DEPLOY_ENV === 'development'
? ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export const ActionbarToggle = () => {
<div className={classes.ActionBarToggleContainer}>
<div className={classes.ActionBarToggleTop}>
<div>
<Avatar src={`https://github.com/${loginName}.png`} size={30} />
<Avatar src={`/avatars/${loginName}.png`} size={30} />
<Text as="strong" className={classes.ActionBarToggleUser}>
{loginName}
</Text>
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/ActionList/ActionList.dev.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const GroupWithSubtleTitleOldAPI = () => {
onSelect={() => toggleAssignee(user)}
>
<ActionList.LeadingVisual>
<Avatar src={`https://github.com/${user.login}.png`} />
<Avatar src={`/avatars/${user.login}.png`} />
</ActionList.LeadingVisual>
{user.login}
<ActionList.Description>{user.name}</ActionList.Description>
Expand Down Expand Up @@ -95,7 +95,7 @@ export const GroupWithFilledTitleOldAPI = () => {
onSelect={() => toggleAssignee(user)}
>
<ActionList.LeadingVisual>
<Avatar src={`https://github.com/${user.login}.png`} />
<Avatar src={`/avatars/${user.login}.png`} />
</ActionList.LeadingVisual>
{user.login}
<ActionList.Description>{user.name}</ActionList.Description>
Expand Down
16 changes: 8 additions & 8 deletions packages/react/src/ActionList/ActionList.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export const WithAvatars = () => (
{users.map(user => (
<ActionList.Item key={user.login}>
<ActionList.LeadingVisual>
<Avatar src={`https://github.com/${user.login}.png`} />
<Avatar src={`/avatars/${user.login}.png`} />
</ActionList.LeadingVisual>
{user.login}
</ActionList.Item>
Expand Down Expand Up @@ -225,7 +225,7 @@ export const InlineDescription = () => (
{users.map(user => (
<ActionList.Item key={user.login}>
<ActionList.LeadingVisual>
<Avatar src={`https://github.com/${user.login}.png`} />
<Avatar src={`/avatars/${user.login}.png`} />
</ActionList.LeadingVisual>
{user.login}
<ActionList.Description>{user.name}</ActionList.Description>
Expand All @@ -239,7 +239,7 @@ export const BlockDescription = () => (
{users.map(user => (
<ActionList.Item key={user.login}>
<ActionList.LeadingVisual>
<Avatar src={`https://github.com/${user.login}.png`} />
<Avatar src={`/avatars/${user.login}.png`} />
</ActionList.LeadingVisual>
{user.login}
<ActionList.Description variant="block">{user.name}</ActionList.Description>
Expand Down Expand Up @@ -644,9 +644,9 @@ export const ConditionalChildren = () => {
<ActionList.Item key={index}>
<ActionList.LeadingVisual>
{reviewer.type === 'team' ? (
<Avatar src={`https://avatars.githubusercontent.com/t/${reviewer.id}`} />
<Avatar src={`/avatars/t-${reviewer.id!}.png`} />
) : (
<Avatar src={`https://avatars.githubusercontent.com/${reviewer.login}`} />
<Avatar src={`/avatars/${reviewer.login!}.png`} />
)}
</ActionList.LeadingVisual>
{reviewer.login || reviewer.slug}
Expand Down Expand Up @@ -687,7 +687,7 @@ export const ChildWithSideEffects = () => {
<ActionList selectionVariant="multiple" role="listbox" aria-label="Assignees">
<ActionList.Item selected={selected} onSelect={() => setSelected(!selected)} role="option">
<ActionList.LeadingVisual>
<Avatar src={`https://avatars.githubusercontent.com/${user.login}`} />
<Avatar src={`/avatars/${user.login}.png`} />
</ActionList.LeadingVisual>
{user.login}
<ActionList.Description>
Expand Down Expand Up @@ -758,7 +758,7 @@ export const GroupWithSubtleTitle = () => {
onSelect={() => toggleAssignee(user)}
>
<ActionList.LeadingVisual>
<Avatar src={`https://github.com/${user.login}.png`} />
<Avatar src={`/avatars/${user.login}.png`} />
</ActionList.LeadingVisual>
{user.login}
<ActionList.Description>{user.name}</ActionList.Description>
Expand Down Expand Up @@ -792,7 +792,7 @@ export const GroupWithFilledTitle = () => {
onSelect={() => toggleAssignee(user)}
>
<ActionList.LeadingVisual>
<Avatar src={`https://github.com/${user.login}.png`} />
<Avatar src={`/avatars/${user.login}.png`} />
</ActionList.LeadingVisual>
{user.login}
<ActionList.Description>{user.name}</ActionList.Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
const hoverCard = (
<Stack gap="condensed" style={{padding: '16px'}}>
<Stack direction="horizontal" gap="condensed" justify="space-between">
<Avatar src="https://avatars.githubusercontent.com/u/7143434?v=4" size={48} />
<Avatar src="/avatars/mona.png" size={48} />
<Button size="small">Follow</Button>
</Stack>
<Stack direction="horizontal" gap="none">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
const hoverCard = (
<Stack gap="condensed" style={{padding: '16px'}}>
<Stack direction="horizontal" gap="condensed" justify="space-between">
<Avatar src="https://avatars.githubusercontent.com/u/7143434?v=4" size={48} />
<Avatar src="/avatars/mona.png" size={48} />
<Button size="small">Follow</Button>
</Stack>
<Stack direction="horizontal" gap="none">
Expand Down
86 changes: 23 additions & 63 deletions packages/react/src/Avatar/Avatar.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,36 @@ export default {
component: Avatar,
} as Meta<typeof Avatar>

export const Square = () => <Avatar square alt="primer" src="https://avatars.githubusercontent.com/primer" />
export const Square = () => <Avatar square alt="primer" src="/avatars/primer.png" />

export const Size = () => (
<div>
<Avatar size={4} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={8} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={12} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={16} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={20} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={24} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={28} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={32} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={40} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={48} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={56} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={64} alt="mona" src="https://avatars.githubusercontent.com/u/7143434?v=4" />
<Avatar size={4} alt="mona" src="/avatars/mona.png" />
<Avatar size={8} alt="mona" src="/avatars/mona.png" />
<Avatar size={12} alt="mona" src="/avatars/mona.png" />
<Avatar size={16} alt="mona" src="/avatars/mona.png" />
<Avatar size={20} alt="mona" src="/avatars/mona.png" />
<Avatar size={24} alt="mona" src="/avatars/mona.png" />
<Avatar size={28} alt="mona" src="/avatars/mona.png" />
<Avatar size={32} alt="mona" src="/avatars/mona.png" />
<Avatar size={40} alt="mona" src="/avatars/mona.png" />
<Avatar size={48} alt="mona" src="/avatars/mona.png" />
<Avatar size={56} alt="mona" src="/avatars/mona.png" />
<Avatar size={64} alt="mona" src="/avatars/mona.png" />
</div>
)

export const SizeResponsive = () => (
<div>
<Avatar
size={{narrow: 4, regular: 8, wide: 12}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 8, regular: 12, wide: 16}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 12, regular: 16, wide: 20}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 16, regular: 20, wide: 24}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 20, regular: 24, wide: 28}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 24, regular: 28, wide: 32}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 28, regular: 32, wide: 40}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 32, regular: 40, wide: 48}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 40, regular: 48, wide: 56}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar
size={{narrow: 48, regular: 56, wide: 64}}
alt="mona"
src="https://avatars.githubusercontent.com/u/7143434?v=4"
/>
<Avatar size={{narrow: 4, regular: 8, wide: 12}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 8, regular: 12, wide: 16}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 12, regular: 16, wide: 20}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 16, regular: 20, wide: 24}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 20, regular: 24, wide: 28}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 24, regular: 28, wide: 32}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 28, regular: 32, wide: 40}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 32, regular: 40, wide: 48}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 40, regular: 48, wide: 56}} alt="mona" src="/avatars/mona.png" />
<Avatar size={{narrow: 48, regular: 56, wide: 64}} alt="mona" src="/avatars/mona.png" />
</div>
)
11 changes: 2 additions & 9 deletions packages/react/src/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,10 @@ type Args = {
sizeAtWide?: number
} & Omit<AvatarProps, 'size'>

export const Default = () => <Avatar src="https://avatars.githubusercontent.com/u/7143434?v=4" />
export const Default = () => <Avatar src="/avatars/mona.png" />

export const Playground: StoryFn<Args> = args => {
return (
<Avatar
size={parseSizeFromArgs(args)}
square={args.square}
src="https://avatars.githubusercontent.com/u/7143434?v=4"
alt="mona"
/>
)
return <Avatar size={parseSizeFromArgs(args)} square={args.square} src="/avatars/mona.png" alt="mona" />
}

Playground.args = {
Expand Down
8 changes: 4 additions & 4 deletions packages/react/src/AvatarStack/AvatarStack.dev.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ export default {
export const WithLinkWrappers = () => (
<AvatarStack>
<Link aria-label="Primer is assigned" href="#" className="pc-AvatarItem" data-hovercard-url="/primer">
<Avatar alt="Primer logo" src="https://avatars.githubusercontent.com/primer" />
<Avatar alt="Primer logo" src="/avatars/primer.png" />
</Link>
<Link aria-label="GitHub is assigned" href="#" className="pc-AvatarItem" data-hovercard-url="/primer">
<Avatar alt="GitHub logo" src="https://avatars.githubusercontent.com/github" />
<Avatar alt="GitHub logo" src="/avatars/github.png" />
</Link>
<Link aria-label="Atom is assigned" href="#" className="pc-AvatarItem" data-hovercard-url="/primer">
<Avatar alt="Atom logo" src="https://avatars.githubusercontent.com/atom" />
<Avatar alt="Atom logo" src="/avatars/atom.png" />
</Link>
<Link aria-label="GitHub Desktop is assigned" href="#" className="pc-AvatarItem" data-hovercard-url="/primer">
<Avatar alt="GitHub Desktop logo" src="https://avatars.githubusercontent.com/desktop" />
<Avatar alt="GitHub Desktop logo" src="/avatars/desktop.png" />
</Link>
</AvatarStack>
)
Loading
Loading