Skip to content

Commit

Permalink
chore(samples): updates Hello and World
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolasleblanc committed Dec 21, 2018
1 parent ade83d8 commit 0827de0
Show file tree
Hide file tree
Showing 21 changed files with 68 additions and 69 deletions.
File renamed without changes.
13 changes: 6 additions & 7 deletions packages/Hello/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@
"version": "0.0.0",
"description": "Hello component",
"scripts": {
"build": "babel src --out-dir dist --verbose --extensions '.ts,.tsx'",
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist",
"prebuild": "rimraf dist && npm run type-check",
"postbuild": "npm run build:types",
"type-check": "tsc --noEmit",
"build": "babel src --out-dir dist --verbose",
"type-check": "echo ''",
"test": "echo \"Error: no test specified\" && exit 1"
},
"files": [
"dist"
],
"main": "dist/index.ts",
"main": "dist/index.js",
"author": "",
"license": "ISC",
"peerDependencies": {
"react": "^16.5.1"
"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"
}
Expand Down
19 changes: 19 additions & 0 deletions packages/Hello/src/Hello.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import PropTypes from "prop-types";

export default class Hello extends React.PureComponent {
static propTypes = {
/** Sample prop that you can change */
dummyProp: PropTypes.string
};

static defaultProps = {
dummyProp: 'My dummy prop default value'
};

render() {
return (
<p>Hello Component - {this.props.dummyProp}</p>
);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from 'react';
import React from 'react';

import { text } from '@storybook/addon-knobs';
import { withInfo } from '@storybook/addon-info';
Expand All @@ -8,7 +8,7 @@ import Hello from './Hello';
import { createStorySetWithDefault, getKnob, getStoryProps } from '@coinsquare/storybook';

const getKnobProps = (exclude = []) => ({
...getKnob('dummyProp', text, 'Dummy Prop', '123', exclude),
...getKnob('dummyProp', text, 'Dummy Prop', 'My dummy prop default value', exclude),
});

const eventHandlers = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React from 'react';
import renderer from 'react-test-renderer';

import World from './World';
import Hello from './Hello';

const createComponent = newProps => {
const component = renderer.create(
<World {...props} />
<Hello {...props} />
);

return {
component
};
};

describe('World component', () => {
describe('Hello component', () => {
it('should render', () => {
const { component } = createComponent();
const tree = component.toJSON();
Expand Down
17 changes: 0 additions & 17 deletions packages/Hello/src/Hello.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/Hello/src/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```js
<Hello dummyProp={123}/>
<Hello dummyProp={'My default dummy prop value'}/>
```
2 changes: 2 additions & 0 deletions packages/Hello/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./Hello";
export { default as Hello } from "./Hello";
2 changes: 0 additions & 2 deletions packages/Hello/src/index.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/World/Readme

This file was deleted.

3 changes: 3 additions & 0 deletions packages/World/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# World

`npm install @coinsquare/world-component`
15 changes: 8 additions & 7 deletions packages/World/package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
{
"name": "@coinsquare/World-component",
"name": "@coinsquare/world-component",
"version": "0.0.0",
"description": "World component",
"scripts": {
"build": "babel src --out-dir dist --verbose",
"type-check": "echo ''",
"build": "babel src --out-dir dist --verbose --extensions '.ts,.tsx'",
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist",
"prebuild": "rimraf dist && npm run type-check",
"postbuild": "npm run build:types",
"type-check": "tsc --noEmit",
"test": "echo \"Error: no test specified\" && exit 1"
},
"files": [
"dist"
],
"main": "dist/index.js",
"main": "dist/index.ts",
"author": "",
"license": "ISC",
"peerDependencies": {
"react": "^16.5.1",
"styled-components": "^3.4.6"
"react": "^16.5.1"
},
"dependencies": {
"styled-system": "^3.1.3",
"@coinsquare/build": "^0.0.0",
"@coinsquare/storybook": "^0.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/World/src/Readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```js
<World dummyProp={123}/>
<World dummyProp={'My default dummy prop value'}/>
```
19 changes: 0 additions & 19 deletions packages/World/src/World.jsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import * as React from 'react';

import { text } from '@storybook/addon-knobs';
import { withInfo } from '@storybook/addon-info';
Expand All @@ -8,7 +8,7 @@ import World from './World';
import { createStorySetWithDefault, getKnob, getStoryProps } from '@coinsquare/storybook';

const getKnobProps = (exclude = []) => ({
...getKnob('dummyProp', text, 'Dummy Prop', '123', exclude),
...getKnob('dummyProp', text, 'Dummy Prop', 'My dummy prop default value', exclude),
});

const eventHandlers = {
Expand Down
17 changes: 17 additions & 0 deletions packages/World/src/World.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as React from "react";

interface WorldProps {
/** Sample prop description */
dummyProp?: string;
}

const World: React.SFC<WorldProps> = props => (
<p>World Component - {props.dummyProp}</p>
);

World.defaultProps = {
/* Sample prop that you can change */
dummyProp: 'My dummy prop default value'
}

export default World;
2 changes: 0 additions & 2 deletions packages/World/src/index.js

This file was deleted.

2 changes: 2 additions & 0 deletions packages/World/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './World';
export { default as World } from './World';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import PropTypes from "prop-types";

export default class {{pascalcase name}} extends React.PureComponent {
static propTypes = {
dummyProp: PropTypes.optionalString
/** Sample prop that you can change */
dummyProp: PropTypes.string
};

static defaultProps = {
/* Sample prop that you can change */
dummyProp: 'My dummy prop default value'
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const {{pascalcase name}}: React.SFC<{{pascalcase name}}Props> = props => (
);

{{pascalcase name}}.defaultProps = {
/* Sample prop that you can change */
dummyProp: 'My dummy prop default value'
}

Expand Down

0 comments on commit 0827de0

Please sign in to comment.