UNPKG

3.41 kBMarkdownView Raw
1# React OUI Icons
2
3Icons for the Optimizely application and other OUI projects.
4
5## Implementation
6
7This implementation consists of a Icon React Component that will generate an inline SVG icon using the data associated with the name of the icon. Any attributes will be passed as props.
8
9[View all the icons](https://github.com/optimizely/react-oui-icons).
10
11## Using the icons
12
131. **Download the package:** Run `yarn add react-oui-icons` to include the latest icons in your project.
14
152. **Using an icon:** You can use one of the icons in the HTML with:
16
17 ```javascript
18 import Icon from 'react-oui-icons';
19
20 ...
21
22 <Icon
23 name="search"
24 description="search"
25 size="medium"
26 fill="black"
27 />
28
29 ...
30 ```
31
32[View all the icons](http://optimizely.github.io/oui/storybook/?knob-href=http%3A%2F%2Fgoogle.com&knob-defaultValue=some%20default%20value&knob-direction=up&knob-default=Link&knob-reverse=Link%20Reverse&knob-color=black&knob-dark=Link%20Dark&knob-max=50&knob-type=text&knob-bad-news=Link%20Bad%20News&knob-isDropdown=true&knob-maxLength=250&knob-muted=Link%20Muted&knob-children=Link&knob-size=medium&knob-style=default&knob-min=10&knob-placeholder=just%20a%20placeholder&knob-Label=&selectedKind=Icons&selectedStory=all%20icons&full=0&addons=1&stories=1&panelRight=1&addonPanel=storybook%2Factions%2Factions-panel).
33
34## Storybook
35`react-oui-icons` uses [Storybook](https://storybook.js.org/)! You can view all of the icons through the Storybook interface by running:
36
37```sh
38yarn run storybook
39```
40
41It will start a local webserver served at `http://localhost:6006/`.
42
43## Adding and editing icons
44
451. Add icons to `assets/svgs/`.
462. Run `yarn svgson` to update the icon internal data file in `src/Icon/icons.json`.
47 - If this command is failing, try running `yarn install` first.
483. Create a new release of `react-oui-icons` (see [Pre-Release](https://github.com/optimizely/react-oui-icons#warning-pre-release) and [Release a new version of react-oui-icons](https://github.com/optimizely/react-oui-icons#release-new-version-of-react-oui-icons))
494. Update version of `react-oui-icons` in Optimizely [OUI](https://github.com/optimizely/oui)'s `package.json` to the latest
505. Create a [new release of OUI](https://github.com/optimizely/oui/blob/devel/CONTRIBUTING.md)
516. Bump the OUI version number in Optimizely's package.json
52
53## Test in Optimizely.git
54
551. `cd ~/react-oui-icons`
562. `yarn link`
573. `cd ~/optimizely`
584. `yarn link react-oui-icons`
595. Use `?use_local_bundle=true` to test your icon changes before releasing with confidence
60
61## :warning: Pre-Release
62
63Don't forget these before you create a release:
64
651. Add a new header to `CHANGELOG.md` under “Unreleased” with the [new version number](https://medium.com/design-optimizely/how-to-version-your-ui-library-1c7a1b7ee23a):
66
67 ```md
68 ## Unreleased
69
70 ## 2.0.0 - 2018-04-13
71 - [Release] Added a cool breaking change. (#999)
72 ```
732. Commit to master: `git add . && git commit -a -m 'Prep for new release version x.y.z'`
74
75## Release new version of react-oui-icons
76
771. `yarn release patch` or `yarn release minor` or `yarn release major`
782. [Create a new release on GitHub](https://github.com/optimizely/react-oui-icons/releases/new):
79 * Select the new tag version
80 * Leave “Release title” blank
81 * Paste in “Unreleased” latest additions from the `CHANGELOG.md` release notes