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
Create @primer/styled-octicons package #417
Merged
Merged
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
b9eaacd
Start styled-octicons package
colebemis 1a0ce68
Attempt to add styled octicons package to workflow
colebemis cedfc45
Remove next site from styled octicons package
colebemis 44a8bc7
Add package-lock
colebemis 9f56fa6
Add files to package.json
colebemis 52b26a5
Update dependencies
colebemis a0de56e
Ad types
colebemis bd0d1dd
Add types for system props
colebemis 7f5b09c
Update tests
colebemis f670ef5
Remove display prop
colebemis aca723e
Add tests for system props
colebemis 3751a86
Update ts-tests
colebemis 07a0bc8
Add @types/styled-system as a dependency
colebemis 79962a1
Add name to workflow steps
colebemis d8dffb8
Start docs for styled-octicons
colebemis 0c5fcfc
Remove prop types
colebemis dddece5
Update docs
colebemis ae29ea7
Write icon components into their own file
colebemis 92d68d5
Fix generated pathname
colebemis 24cce42
Fix lint error
colebemis a1fb469
Bundle individual icons
colebemis 44c5a6d
Write copy script
colebemis ba674af
Update package lock
colebemis af9c04b
Add sx prop
colebemis ba70d35
Update lib/octicons_styled/script/copy.sh
colebemis 394a15b
Run copy script after rollup
colebemis c36f7e4
Merge branch 'styled-octicons' of github.com:primer/octicons into sty…
colebemis 7c415e0
Update docs
colebemis 35511fe
Export Icon and IconProps
colebemis df8e278
Merge remote-tracking branch 'origin/v2' into styled-octicons
colebemis File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: Styled System | ||
status: Experimental | ||
source: 'https://github.com/primer/octicons/tree/v2/lib/octicons_styled' | ||
--- | ||
|
||
[![npm version](https://img.shields.io/npm/v/@primer/styled-octicons/canary.svg)](https://www.npmjs.org/package/@primer/styled-octicons) | ||
|
||
The `@primer/styled-octicons` package wraps icon components from [`@primer/octicons-v2-react`](/packages/react) with [system props](https://primer.style/components/system-props), making them easier to style in projects that use [styled system](https://styled-system.com/)—like [Primer Components](https://primer.style/components). | ||
|
||
## Install | ||
|
||
```shell | ||
npm install @primer/styled-octicons@canary | ||
``` | ||
|
||
## Usage | ||
|
||
`@primer/styled-octicons` exports each icons as a named export. This allows you to import only the icons you need: | ||
|
||
```jsx | ||
import {AlertIcon} from '@primer/styled-octicons' | ||
|
||
export () => ( | ||
<AlertIcon color="red.6" mr={2} /> | ||
) | ||
``` | ||
|
||
## System props | ||
|
||
All icon components in `@primer/styled-octicons` get `COMMON` system props. Read our [System Props](https://primer.style/components/system-props) documentation for a full list of available props. | ||
colebemis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
## Props | ||
|
||
In addition to system props, icon components in `@primer/styled-octicons` accept the same props as components in `@primer/octicons-v2-react`: | ||
|
||
| Name | Type | Default | Description | | ||
| :- | :- | :-: | :- | | ||
| aria-label | String | | Sets the [`aria-label`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute) attribute of the `<svg>`. If no `aria-label` is defined, `aria-hidden` will be set to `true`. | | ||
| className | String | | Sets the `class` attribute on the `<svg>` | | ||
| size | Number \| `"small"` \| `"medium"` \| `"large"` | `16` | The height of the icon. Width will be scaled proportionally. | | ||
| verticalAlign | `"middle"` \| `"text-bottom"` \| `"text-top"` \| `"top"` \| `"unset"` | `"text-bottom"` | The vertical alignment of the `<svg>` | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"presets": ["env", "stage-0", "react"], | ||
"env": { | ||
"production": { | ||
"presets": ["next/babel"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/__generated__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": [ | ||
"plugin:github/recommended", | ||
"plugin:github/es6", | ||
"plugin:github/react" | ||
], | ||
"rules": { | ||
}, | ||
"settings": { | ||
"react": { | ||
"version": "16" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.cache | ||
.next | ||
dist/ | ||
src/__generated__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.config.js | ||
.*.sw? | ||
.*rc | ||
.cache | ||
.eslint* | ||
.gitignore | ||
.next | ||
script | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 GitHub Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# @primer/octicons-react | ||
|
||
[![npm version](https://img.shields.io/npm/v/@primer/octicons-react.svg)](https://www.npmjs.org/package/@primer/octicons-react) | ||
colebemis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
See https://primer.style/octicons/packages/styled-system |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we recommend folks to install the canary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until the
v2
branch is merged, there won't actually be a@latest
version of the package. When thev2
branch is merged, we'll update the docs to remove@canary
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌