Skip to content
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
7 changes: 7 additions & 0 deletions .changeset/kind-readers-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@primer/react": major
---

Remove StyledOcticon component. The component was renamed to `Octicon`. Update your imports by swapping `StyledOcticon` with `Octicon`

<!-- Changed components: Octicon -->
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import {test, expect} from '@playwright/test'
import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

test.describe('StyledOcticon', () => {
test.describe('Octicon', () => {
test.describe('Default', () => {
for (const theme of themes) {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-styledocticon--default',
id: 'components-octicon--default',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`StyledOcticon.Default.${theme}.png`)
expect(await page.screenshot()).toMatchSnapshot(`Octicon.Default.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-styledocticon--default',
id: 'components-octicon--default',
globals: {
colorScheme: theme,
},
Expand All @@ -36,19 +36,19 @@ test.describe('StyledOcticon', () => {
test.describe(theme, () => {
test('default @vrt', async ({page}) => {
await visit(page, {
id: 'components-styledocticon--playground',
id: 'components-octicon--playground',
globals: {
colorScheme: theme,
},
})

// Default state
expect(await page.screenshot()).toMatchSnapshot(`StyledOcticon.Playground.${theme}.png`)
expect(await page.screenshot()).toMatchSnapshot(`Octicon.Playground.${theme}.png`)
})

test('axe @aat', async ({page}) => {
await visit(page, {
id: 'components-styledocticon--playground',
id: 'components-octicon--playground',
globals: {
colorScheme: theme,
},
Expand Down
6 changes: 3 additions & 3 deletions script/generate-e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1114,15 +1114,15 @@ const components = new Map([
},
],
[
'StyledOcticon',
'Octicon',
{
stories: [
{
id: 'components-styledocticon--default',
id: 'components-octicon--default',
name: 'Default',
},
{
id: 'components-styledocticon--playground',
id: 'components-octicon--playground',
name: 'Playground',
},
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react'
import {Meta, ComponentStory} from '@storybook/react'
import StyledOcticon from './StyledOcticon'
import Octicon from './Octicon'
import {HeartFillIcon} from '@primer/octicons-react'

export default {
title: 'Components/StyledOcticon',
component: StyledOcticon,
} as Meta<typeof StyledOcticon>
title: 'Components/Octicon',
component: Octicon,
} as Meta<typeof Octicon>

export const Default = () => <StyledOcticon icon={HeartFillIcon} size={32} />
export const Default = () => <Octicon icon={HeartFillIcon} size={32} />

export const Playground: ComponentStory<typeof StyledOcticon> = args => <StyledOcticon icon={HeartFillIcon} {...args} />
export const Playground: ComponentStory<typeof Octicon> = args => <Octicon icon={HeartFillIcon} {...args} />

Playground.args = {
ariaLabel: 'Heart',
Expand Down
5 changes: 0 additions & 5 deletions src/StyledOcticon/StyledOcticon.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/StyledOcticon/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions src/__tests__/StyledOcticon.test.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions src/__tests__/StyledOcticon.types.test.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions src/__tests__/__snapshots__/StyledOcticon.test.tsx.snap

This file was deleted.

1 change: 0 additions & 1 deletion src/__tests__/__snapshots__/exports.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ exports[`@primer/react should not update exports without a semver change 1`] = `
"Spinner",
"SplitPageLayout",
"StateLabel",
"StyledOcticon",
"SubNav",
"TabNav",
"Text",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/storybook.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const allowlist = [
'IconButton',
'FilteredActionList',
'Link',
'Octicon',
'MarkdownEditor',
'Pagehead',
'Pagination',
Expand All @@ -39,7 +40,6 @@ const allowlist = [
'SegmentedControl',
'Spinner',
'StateLabel',
'StyledOcticon',
'SubNav',
'TabNav',
'Textarea',
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ export {default as Spinner} from './Spinner'
export type {SpinnerProps} from './Spinner'
export {default as StateLabel} from './StateLabel'
export type {StateLabelProps} from './StateLabel'
export {default as StyledOcticon} from './StyledOcticon'
export type {StyledOcticonProps} from './StyledOcticon'
export {default as SubNav} from './SubNav'
export type {SubNavProps, SubNavLinkProps, SubNavLinksProps} from './SubNav'
export {default as ToggleSwitch} from './ToggleSwitch'
Expand Down