Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nik): adds nik component
Browse files Browse the repository at this point in the history
nikolasleblanc committed Sep 18, 2018
1 parent 180de3c commit befb272
Showing 8 changed files with 107 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/Nik/Readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Nik

`npm install @coinsquare/nik-component`
1 change: 1 addition & 0 deletions packages/Nik/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@coinsquare/build/babel.config");
25 changes: 25 additions & 0 deletions packages/Nik/package.json
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"
}
}
18 changes: 18 additions & 0 deletions packages/Nik/src/Nik.jsx
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>
);
}
}
33 changes: 33 additions & 0 deletions packages/Nik/src/Nik.story.jsx
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;
22 changes: 22 additions & 0 deletions packages/Nik/src/Nik.test.js
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();
});
});
3 changes: 3 additions & 0 deletions packages/Nik/src/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```js
<Nik/>
```
2 changes: 2 additions & 0 deletions packages/Nik/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./Nik";
export { default as Nik } from "./Nik";

0 comments on commit befb272

Please sign in to comment.