Skip to content

Rename component StyledOcticon to Octicon #3148

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 28 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
45b331f
Rename component StyledOcticon to Octicon
jonrohan Apr 10, 2023
53ce5f5
Update generated/components.json
jonrohan Apr 10, 2023
76994d0
Create .changeset/swift-cows-rest.md
jonrohan Apr 10, 2023
5290d86
Fix snapshot
jonrohan Apr 10, 2023
eac347d
Add segments to progressbar (#3114)
radglob Apr 11, 2023
3b6d537
refactor(CircleOcticon): Move files to folder, add storybook and e2e …
radglob Apr 11, 2023
b061087
Refactor(Popover): move files into folder, add storybook and e2e test…
radglob Apr 11, 2023
ccf9704
refactor(ButtonGroup): move files to folder. (#3117)
radglob Apr 11, 2023
332caf3
docs(project): move code of conduct under .github (#3145)
joshblack Apr 11, 2023
41ace87
Add npm workspaces structure to primer/react (#3074)
joshblack Apr 11, 2023
f645b11
Merge branch 'main' into rename_styledocticon
jonrohan Apr 11, 2023
36e1235
Update generated/components.json
jonrohan Apr 11, 2023
bc227a7
change styled_octicon key
jonrohan Apr 11, 2023
56f324f
Update generated/components.json
jonrohan Apr 11, 2023
ffad8fe
Merge branch 'main' into rename_styledocticon
jonrohan Apr 13, 2023
386ecfc
Update generated/components.json
jonrohan Apr 13, 2023
f37ce4e
Merge branch 'main' into rename_styledocticon
jonrohan Apr 17, 2023
f0b7ab4
Merge branch 'main' into rename_styledocticon
jonrohan Apr 18, 2023
6a170a1
Update generated/components.json
jonrohan Apr 18, 2023
dd10834
Merge branch 'main' into rename_styledocticon
Apr 20, 2023
b88ee6f
Merge branch 'main' into rename_styledocticon
jonrohan Apr 24, 2023
d05ecff
Octicon folder
jonrohan Apr 24, 2023
9e3d5b3
Fix package-lock
jonrohan Apr 24, 2023
c0f5283
Fix imports
jonrohan Apr 24, 2023
59772eb
update path
jonrohan Apr 24, 2023
32e9a73
Update generated/components.json
jonrohan Apr 24, 2023
5821e73
Merge branch 'main' into rename_styledocticon
jonrohan Apr 25, 2023
5c32fe6
Merge branch 'main' into rename_styledocticon
jonrohan May 12, 2023
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/swift-cows-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

Rename component StyledOcticon to Octicon
12 changes: 6 additions & 6 deletions codemods/__tests__/removeSystemProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@ defineInlineTest(
removeSystemProps,
{},
`
import {Button, StyledOcticon} from '@primer/components'
import {Button, Octicon} from '@primer/components'
import {CheckIcon, ClippyIcon} from '@primer/octicons-react'

const ClipboardCopy = ({value}) => <Button px={2}>
{copied ? (
<StyledOcticon icon={CheckIcon} color="green.5" />
<Octicon icon={CheckIcon} color="green.5" />
) : (
<StyledOcticon icon={ClippyIcon} color="gray.5" />
<Octicon icon={ClippyIcon} color="gray.5" />
)}
</Button>

`.trim(),
`
import {Button, StyledOcticon} from '@primer/components'
import {Button, Octicon} from '@primer/components'
import {CheckIcon, ClippyIcon} from '@primer/octicons-react'

const ClipboardCopy = ({value}) => (
<Button sx={{px: 2}}>
{copied ? (
<StyledOcticon icon={CheckIcon} sx={{color: 'green.5'}} />
<Octicon icon={CheckIcon} sx={{color: 'green.5'}} />
) : (
<StyledOcticon icon={ClippyIcon} sx={{color: 'gray.5'}} />
<Octicon icon={ClippyIcon} sx={{color: 'gray.5'}} />
)}
</Button>
)`.trim(),
Expand Down
2 changes: 1 addition & 1 deletion codemods/removeSystemProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const stylePropsMap = {
SideNav: [...COMMON],
Spinner: [...COMMON],
StateLabel: [...COMMON],
StyledOcticon: [...COMMON],
Octicon: [...COMMON],
SubNav: [...COMMON, ...FLEX],
TabNav: [...COMMON],
TabNavLink: [...COMMON, ...TYPOGRAPHY],
Expand Down
2 changes: 1 addition & 1 deletion docs/content/Flash.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Flash components with icons inside of them will automatically set the correct co

```jsx live
<Flash variant="success">
<StyledOcticon icon={CheckIcon} />
<Octicon icon={CheckIcon} />
Success!
</Flash>
```
Expand Down
2 changes: 1 addition & 1 deletion docs/content/Header.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ All items directly under the Header component should be a `Header.Item` componen
<Header>
<Header.Item>
<Header.Link href="#" fontSize={2}>
<StyledOcticon icon={MarkGithubIcon} size={32} sx={{mr: 2}} />
<Octicon icon={MarkGithubIcon} size={32} sx={{mr: 2}} />
<span>GitHub</span>
</Header.Link>
</Header.Item>
Expand Down
14 changes: 7 additions & 7 deletions docs/content/StyledOcticon.mdx → docs/content/Octicon.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
description: Use StyledOcticon to render an Octicon as a component.
title: StyledOcticon
description: Use Octicon to render an Octicon as a component.
title: Octicon
status: Alpha
source: https://github.com/primer/react/blob/main/src/StyledOcticon/StyledOcticon.tsx
componentId: styled_octicon
source: https://github.com/primer/react/blob/main/src/Octicon/Octicon.tsx
componentId: octicon
---

import data from '../../src/StyledOcticon/StyledOcticon.docs.json'
import data from '../../src/Octicon/Octicon.docs.json'

## Example

```jsx live
<>
<StyledOcticon icon={CheckIcon} size={32} color="success.fg" sx={{mr: 2}} />
<StyledOcticon icon={XIcon} size={32} color="danger.fg" />
<Octicon icon={CheckIcon} size={32} color="success.fg" sx={{mr: 2}} />
<Octicon icon={XIcon} size={32} color="danger.fg" />
</>
```

Expand Down
20 changes: 10 additions & 10 deletions docs/content/Timeline.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The Timeline.Item component is used to display items on a vertical timeline, con
<Timeline>
<Timeline.Item>
<Timeline.Badge>
<StyledOcticon icon={FlameIcon} />
<Octicon icon={FlameIcon} />
</Timeline.Badge>
<Timeline.Body>
<Link href="#" sx={{fontWeight: 'bold', color: 'fg.default', mr: 1}} muted>
Expand All @@ -41,7 +41,7 @@ The default Timeline.Badge color is dark text on a light grey background.
<Timeline>
<Timeline.Item>
<Timeline.Badge>
<StyledOcticon icon={FlameIcon} />
<Octicon icon={FlameIcon} />
</Timeline.Badge>
<Timeline.Body>Default badge color</Timeline.Body>
</Timeline.Item>
Expand All @@ -51,25 +51,25 @@ The default Timeline.Badge color is dark text on a light grey background.
### Adding color to a Badge

To have color variants, use the `bg` prop on the `Timeline.Badge`. If an icon is being used, set the `color` prop
of the child `StyledOcticon` if necessary.
of the child `Octicon` if necessary.

```jsx live
<Timeline>
<Timeline.Item>
<Timeline.Badge sx={{bg: 'danger.emphasis'}}>
<StyledOcticon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
<Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
</Timeline.Badge>
<Timeline.Body>Background used when closed events occur</Timeline.Body>
</Timeline.Item>
<Timeline.Item>
<Timeline.Badge sx={{bg: 'danger.emphasis'}}>
<StyledOcticon icon={FlameIcon} color="fg.onEmphasis" />
<Octicon icon={FlameIcon} color="fg.onEmphasis" />
</Timeline.Badge>
<Timeline.Body>Background when opened or passed events occur</Timeline.Body>
</Timeline.Item>
<Timeline.Item>
<Timeline.Badge sx={{bg: 'danger.emphasis'}}>
<StyledOcticon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
<Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
</Timeline.Badge>
<Timeline.Body>Background used when pull requests are merged</Timeline.Body>
</Timeline.Item>
Expand All @@ -84,13 +84,13 @@ Timeline has a condensed prop that will reduce the vertical padding and remove t
<Timeline>
<Timeline.Item condensed>
<Timeline.Badge>
<StyledOcticon icon={GitCommitIcon} />
<Octicon icon={GitCommitIcon} />
</Timeline.Badge>
<Timeline.Body>This is the message of a condensed TimelineItem</Timeline.Body>
</Timeline.Item>
<Timeline.Item condensed>
<Timeline.Badge>
<StyledOcticon icon={GitCommitIcon} />
<Octicon icon={GitCommitIcon} />
</Timeline.Badge>
<Timeline.Body>This is the message of a condensed TimelineItem</Timeline.Body>
</Timeline.Item>
Expand All @@ -105,14 +105,14 @@ To create a visual break in the timeline, use Timeline.Break. This adds a horizo
<Timeline>
<Timeline.Item>
<Timeline.Badge sx={{bg: 'danger.emphasis'}}>
<StyledOcticon icon={FlameIcon} color="fg.onEmphasis" />
<Octicon icon={FlameIcon} color="fg.onEmphasis" />
</Timeline.Badge>
<Timeline.Body>Background used when closed events occur</Timeline.Body>
</Timeline.Item>
<Timeline.Break />
<Timeline.Item>
<Timeline.Badge sx={{bg: 'success.emphasis'}}>
<StyledOcticon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
<Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
</Timeline.Badge>
<Timeline.Body>Background when opened or passed events occur</Timeline.Body>
</Timeline.Item>
Expand Down
6 changes: 3 additions & 3 deletions docs/content/TreeView.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {TreeView} from '@primer/react'
</TreeView.LeadingVisual>
Avatar.tsx
<TreeView.TrailingVisual>
<StyledOcticon icon={DiffAddedIcon} color="success.fg" aria-label="added" />
<Octicon icon={DiffAddedIcon} color="success.fg" aria-label="added" />
</TreeView.TrailingVisual>
</TreeView.Item>
<TreeView.Item id="src/Button.tsx" current>
Expand All @@ -43,7 +43,7 @@ import {TreeView} from '@primer/react'
</TreeView.LeadingVisual>
Button.tsx
<TreeView.TrailingVisual>
<StyledOcticon icon={DiffModifiedIcon} color="attention.fg" aria-label="modified" />
<Octicon icon={DiffModifiedIcon} color="attention.fg" aria-label="modified" />
</TreeView.TrailingVisual>
</TreeView.Item>
</TreeView.SubTree>
Expand All @@ -54,7 +54,7 @@ import {TreeView} from '@primer/react'
</TreeView.LeadingVisual>
package.json
<TreeView.TrailingVisual>
<StyledOcticon icon={DiffModifiedIcon} color="attention.fg" aria-label="modified" />
<Octicon icon={DiffModifiedIcon} color="attention.fg" aria-label="modified" />
</TreeView.TrailingVisual>
</TreeView.Item>
</TreeView>
Expand Down
10 changes: 5 additions & 5 deletions docs/content/deprecated/SideNav.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ Add the `variant='full'` prop to a `SideNav.Link` to spread child elements acros
<Text>With an avatar</Text>
</SideNav.Link>
<SideNav.Link href="#url">
<StyledOcticon sx={{mr: 2}} size={16} icon={ZapIcon} />
<Octicon sx={{mr: 2}} size={16} icon={ZapIcon} />
<Text>With an Octicon</Text>
</SideNav.Link>
<SideNav.Link href="#url" variant="full" selected>
<Text>With a status icon</Text>
<StyledOcticon sx={{mr: 2}} size={16} icon={DotIcon} color="success.fg" />
<Octicon sx={{mr: 2}} size={16} icon={DotIcon} color="success.fg" />
</SideNav.Link>
<SideNav.Link href="#url" variant="full">
<Text>With a label</Text>
Expand Down Expand Up @@ -142,11 +142,11 @@ It can also appear nested, as a sub navigation. Use margin/padding [System Props
```jsx live
<SideNav bordered maxWidth={360}>
<SideNav.Link href="#url">
<StyledOcticon size={16} icon={PersonIcon} />
<Octicon size={16} icon={PersonIcon} />
<Text>Account</Text>
</SideNav.Link>
<SideNav.Link href="#url" selected>
<StyledOcticon mr={2} size={16} icon={SmileyIcon} />
<Octicon mr={2} size={16} icon={SmileyIcon} />
<Text>Profile</Text>
</SideNav.Link>

Expand All @@ -163,7 +163,7 @@ It can also appear nested, as a sub navigation. Use margin/padding [System Props
</SideNav>

<SideNav.Link href="#url">
<StyledOcticon mr={2} size={16} icon={MailIcon} />
<Octicon mr={2} size={16} icon={MailIcon} />
<Text>Emails</Text>
</SideNav.Link>
</SideNav>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@
url: /SplitPageLayout
- title: StateLabel
url: /StateLabel
- title: StyledOcticon
url: /StyledOcticon
- title: Octicon
url: /Octicon
- title: SubNav
url: /SubNav
- title: ToggleSwitch
Expand Down
8 changes: 4 additions & 4 deletions docs/src/component-checklist.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Box, StyledOcticon, Link, Text} from '@primer/react'
import {Box, Octicon, Link, Text} from '@primer/react'
import {H3} from '@primer/gatsby-theme-doctocat/src/components/heading'
import {CheckCircleFillIcon, CircleIcon, SkipIcon} from '@primer/octicons-react'
import React from 'react'
Expand Down Expand Up @@ -88,11 +88,11 @@ Checklist.Item = ({checked, children}) => {
<Box as="li" display="grid" gridTemplateColumns="auto 1fr" gridGap={2} sx={{listStyleType: 'none'}}>
<Box height="24px" display="flex" alignItems="center">
{checked ? (
<StyledOcticon aria-label="Completed" icon={CheckCircleFillIcon} sx={{color: 'success.fg'}} />
<Octicon aria-label="Completed" icon={CheckCircleFillIcon} sx={{color: 'success.fg'}} />
) : checked === null ? (
<StyledOcticon icon={SkipIcon} sx={{color: 'fg.subtle'}} />
<Octicon icon={SkipIcon} sx={{color: 'fg.subtle'}} />
) : (
<StyledOcticon aria-label="To do" icon={CircleIcon} sx={{color: 'fg.subtle'}} />
<Octicon aria-label="To do" icon={CircleIcon} sx={{color: 'fg.subtle'}} />
)}
</Box>
<Text color={checked === null ? 'fg.subtle' : 'fg.default'}>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/component-statuses.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import componentMetadata from '@primer/component-metadata'
import {Link, Label, StyledOcticon} from '@primer/react'
import {Link, Label, Octicon} from '@primer/react'
import {AccessibilityInsetIcon} from '@primer/octicons-react'
import StatusLabel from '@primer/gatsby-theme-doctocat/src/components/status-label'
import Table from '@primer/gatsby-theme-doctocat/src/components/table'
Expand Down Expand Up @@ -79,7 +79,7 @@ export function ComponentStatuses() {
borderColor: 'transparent',
}}
>
<StyledOcticon icon={AccessibilityInsetIcon} sx={{fill: 'done.fg'}} />
<Octicon icon={AccessibilityInsetIcon} sx={{fill: 'done.fg'}} />
Reviewed
</Label>
) : (
Expand Down
Loading