-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1 parent
180de3c
commit befb272
Showing
8 changed files
with
107 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Nik | ||
|
||
`npm install @coinsquare/nik-component` |
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 @@ | ||
module.exports = require("@coinsquare/build/babel.config"); |
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,25 @@ | ||
{ | ||
"name": "@coinsquare/nik-component", | ||
"version": "0.0.0", | ||
"description": "Nik component", | ||
"scripts": { | ||
"build": "babel src --out-dir dist --verbose", | ||
"type-check": "echo ''", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "dist/index.js", | ||
"author": "", | ||
"license": "ISC", | ||
"peerDependencies": { | ||
"react": "^16.5.1", | ||
"styled-components": "^3.4.6" | ||
}, | ||
"dependencies": { | ||
"styled-system": "^3.1.3", | ||
"@coinsquare/build": "^0.0.0", | ||
"@coinsquare/storybook": "^0.0.0" | ||
} | ||
} |
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,18 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
export default class Nik extends React.PureComponent { | ||
static propTypes = { | ||
dummyProp: PropTypes.number | ||
}; | ||
|
||
static defaultProps = { | ||
dummyProp: 123 | ||
}; | ||
|
||
render() { | ||
return ( | ||
<p>replace me</p> | ||
); | ||
} | ||
} |
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,33 @@ | ||
import React from 'react'; | ||
|
||
import { text } from '@storybook/addon-knobs'; | ||
import { withInfo } from '@storybook/addon-info'; | ||
|
||
import Nik from './Nik'; | ||
|
||
import { createStorySetWithDefault, getKnob, getStoryProps } from '@coinsquare/storybook'; | ||
|
||
const getKnobProps = exclude => ({ | ||
/* knob props */ | ||
}); | ||
|
||
const eventHandlers = { | ||
/* event handlers */ | ||
}; | ||
|
||
const getProps = getStoryProps(getKnobProps, eventHandlers); | ||
|
||
const stories = createStorySetWithDefault('Nik', getProps, Nik) | ||
// prevents container from taking full width | ||
.addDecorator(story => <div>{story()}</div>); | ||
/* | ||
// add other stories here | ||
.add('With Icon', () => { | ||
const props = { | ||
...getProps(['icon']) | ||
}; | ||
return <Nik {...props} icon={'1'} />; | ||
}); | ||
*/ | ||
|
||
export default stories; |
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,22 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
|
||
import Nik from './Nik'; | ||
|
||
const createComponent = newProps => { | ||
const component = renderer.create( | ||
<Nik {...props} /> | ||
); | ||
|
||
return { | ||
component | ||
}; | ||
}; | ||
|
||
describe('Nik component', () => { | ||
it('should render', () => { | ||
const { component } = createComponent(); | ||
const tree = component.toJSON(); | ||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
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,3 @@ | ||
```js | ||
<Nik/> | ||
``` |
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,2 @@ | ||
export { default } from "./Nik"; | ||
export { default as Nik } from "./Nik"; |