Skip to content

Commit

Permalink
Revert "Rename component StyledOcticon to Octicon (#3148)"
Browse files Browse the repository at this point in the history
This reverts commit ac437bb.
  • Loading branch information
broccolinisoup committed May 16, 2023
1 parent 9d151e8 commit 5695709
Show file tree
Hide file tree
Showing 37 changed files with 173 additions and 245 deletions.
5 changes: 0 additions & 5 deletions .changeset/swift-cows-rest.md

This file was deleted.

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, Octicon} from '@primer/components'
import {Button, StyledOcticon} from '@primer/components'
import {CheckIcon, ClippyIcon} from '@primer/octicons-react'
const ClipboardCopy = ({value}) => <Button px={2}>
{copied ? (
<Octicon icon={CheckIcon} color="green.5" />
<StyledOcticon icon={CheckIcon} color="green.5" />
) : (
<Octicon icon={ClippyIcon} color="gray.5" />
<StyledOcticon icon={ClippyIcon} color="gray.5" />
)}
</Button>
`.trim(),
`
import {Button, Octicon} from '@primer/components'
import {Button, StyledOcticon} from '@primer/components'
import {CheckIcon, ClippyIcon} from '@primer/octicons-react'
const ClipboardCopy = ({value}) => (
<Button sx={{px: 2}}>
{copied ? (
<Octicon icon={CheckIcon} sx={{color: 'green.5'}} />
<StyledOcticon icon={CheckIcon} sx={{color: 'green.5'}} />
) : (
<Octicon icon={ClippyIcon} sx={{color: 'gray.5'}} />
<StyledOcticon 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],
Octicon: [...COMMON],
StyledOcticon: [...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">
<Octicon icon={CheckIcon} />
<StyledOcticon 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}>
<Octicon icon={MarkGithubIcon} size={32} sx={{mr: 2}} />
<StyledOcticon icon={MarkGithubIcon} size={32} sx={{mr: 2}} />
<span>GitHub</span>
</Header.Link>
</Header.Item>
Expand Down
14 changes: 7 additions & 7 deletions docs/content/Octicon.mdx → docs/content/StyledOcticon.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
description: Use Octicon to render an Octicon as a component.
title: Octicon
description: Use StyledOcticon to render an Octicon as a component.
title: StyledOcticon
status: Alpha
source: https://github.com/primer/react/blob/main/src/Octicon/Octicon.tsx
componentId: octicon
source: https://github.com/primer/react/blob/main/src/StyledOcticon/StyledOcticon.tsx
componentId: styled_octicon
---

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

## Example

```jsx live
<>
<Octicon icon={CheckIcon} size={32} color="success.fg" sx={{mr: 2}} />
<Octicon icon={XIcon} size={32} color="danger.fg" />
<StyledOcticon icon={CheckIcon} size={32} color="success.fg" sx={{mr: 2}} />
<StyledOcticon 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>
<Octicon icon={FlameIcon} />
<StyledOcticon 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>
<Octicon icon={FlameIcon} />
<StyledOcticon 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 `Octicon` if necessary.
of the child `StyledOcticon` if necessary.

```jsx live
<Timeline>
<Timeline.Item>
<Timeline.Badge sx={{bg: 'danger.emphasis'}}>
<Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
<StyledOcticon 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'}}>
<Octicon icon={FlameIcon} color="fg.onEmphasis" />
<StyledOcticon 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'}}>
<Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
<StyledOcticon 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>
<Octicon icon={GitCommitIcon} />
<StyledOcticon icon={GitCommitIcon} />
</Timeline.Badge>
<Timeline.Body>This is the message of a condensed TimelineItem</Timeline.Body>
</Timeline.Item>
<Timeline.Item condensed>
<Timeline.Badge>
<Octicon icon={GitCommitIcon} />
<StyledOcticon 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'}}>
<Octicon icon={FlameIcon} color="fg.onEmphasis" />
<StyledOcticon 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'}}>
<Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />
<StyledOcticon 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>
<Octicon icon={DiffAddedIcon} color="success.fg" aria-label="added" />
<StyledOcticon 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>
<Octicon icon={DiffModifiedIcon} color="attention.fg" aria-label="modified" />
<StyledOcticon 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>
<Octicon icon={DiffModifiedIcon} color="attention.fg" aria-label="modified" />
<StyledOcticon 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">
<Octicon sx={{mr: 2}} size={16} icon={ZapIcon} />
<StyledOcticon 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>
<Octicon sx={{mr: 2}} size={16} icon={DotIcon} color="success.fg" />
<StyledOcticon 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">
<Octicon size={16} icon={PersonIcon} />
<StyledOcticon size={16} icon={PersonIcon} />
<Text>Account</Text>
</SideNav.Link>
<SideNav.Link href="#url" selected>
<Octicon mr={2} size={16} icon={SmileyIcon} />
<StyledOcticon 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">
<Octicon mr={2} size={16} icon={MailIcon} />
<StyledOcticon 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: Octicon
url: /Octicon
- title: StyledOcticon
url: /StyledOcticon
- 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, Octicon, Link, Text} from '@primer/react'
import {Box, StyledOcticon, 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 ? (
<Octicon aria-label="Completed" icon={CheckCircleFillIcon} sx={{color: 'success.fg'}} />
<StyledOcticon aria-label="Completed" icon={CheckCircleFillIcon} sx={{color: 'success.fg'}} />
) : checked === null ? (
<Octicon icon={SkipIcon} sx={{color: 'fg.subtle'}} />
<StyledOcticon icon={SkipIcon} sx={{color: 'fg.subtle'}} />
) : (
<Octicon aria-label="To do" icon={CircleIcon} sx={{color: 'fg.subtle'}} />
<StyledOcticon 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, Octicon} from '@primer/react'
import {Link, Label, StyledOcticon} 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',
}}
>
<Octicon icon={AccessibilityInsetIcon} sx={{fill: 'done.fg'}} />
<StyledOcticon icon={AccessibilityInsetIcon} sx={{fill: 'done.fg'}} />
Reviewed
</Label>
) : (
Expand Down
Loading

0 comments on commit 5695709

Please sign in to comment.