Created
July 27, 2018 02:48
-
-
Save liamdawson/17e52e51d59069c72f25eb35949b3e20 to your computer and use it in GitHub Desktop.
Type usage examples for octicons-react
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
import React from 'react'; | |
// all of the icons are auto-completeable in IDE imports | |
import Octicon, {Globe, getIconByName} from '@githubprimer/octicons-react'; | |
import {storiesOf} from '@storybook/react'; | |
storiesOf('Icon', module) | |
// won't compile, icon prop required | |
.add('Empty icon', () => <Octicon />) | |
// won't compile, string not assignable, needs to be Icon<x, y>, or a StatelessComponent | |
.add('Passing invalid item', () => <Octicon icon="globe" />) | |
.add('Passing valid item', () => <Octicon icon={Globe} />) | |
.add('Passing valid item by string ref', () => <Octicon icon={getIconByName('globe')} />); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment