-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Table and Playground packages (#154)
* Add table package * Add playground package and move all stories to there * integrating with react-virtualized * Add Fixed column table * Stick to default prettier setting * Add createNodeMock to let test pass * Fix `multiStoryshot` with jest styled-component
- Loading branch information
Showing
108 changed files
with
11,289 additions
and
3,953 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 |
---|---|---|
|
@@ -15,5 +15,6 @@ flow/* | |
[lints] | ||
|
||
[options] | ||
module.system=haste | ||
|
||
[strict] |
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 |
---|---|---|
|
@@ -12,4 +12,4 @@ storybook-static | |
bit.json | ||
yarn-error.log | ||
bundle-stats.html | ||
__mocks__ | ||
**/__mocks__/** |
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 |
---|---|---|
@@ -1,10 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"semi": true, | ||
"bracketSpacing": true, | ||
"printWidth": 70, | ||
"parser": "flow", | ||
"jsxBracketSameLine": false, | ||
"arrowParens": "avoid" | ||
"printWidth": 70 | ||
} |
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
File renamed without changes
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
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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 @@ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
import initStoryshots, { | ||
multiSnapshotWithOptions, | ||
} from '@storybook/addon-storyshots'; | ||
import styleSheetSerializer from 'jest-styled-components/src/styleSheetSerializer'; | ||
import { addSerializer } from 'jest-specific-snapshot' | ||
import { Table, SimpleTable } from '../../table/src'; | ||
|
||
/** | ||
* Mock methods of addon-info so that "Show Info" button don't go into snapshots. | ||
* https://github.com/storybooks/storybook/issues/1011#issuecomment-322698049 | ||
*/ | ||
jest.mock('@storybook/addon-info', () => ({ | ||
withInfo: () => storyFn => storyFn, | ||
setDefaults: () => {}, | ||
})); | ||
|
||
/** | ||
* Add custom serializer in order to work with multiSnapShot | ||
* https://github.com/storybooks/storybook/issues/887#issuecomment-357073807 | ||
*/ | ||
addSerializer(styleSheetSerializer); | ||
|
||
initStoryshots({ | ||
test: multiSnapshotWithOptions({ | ||
createNodeMock: (element) => { | ||
if (element.type === Table || SimpleTable ) { | ||
return document.createElement('div') | ||
} | ||
}, | ||
}) | ||
}); |
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 @@ | ||
const path = require('path'); | ||
|
||
module.exports = (baseConfig, env, defaultConfig) => { | ||
// Extend defaultConfig as you need. | ||
const appFolder = path.resolve(__dirname, '../../../'); | ||
// Include other packages becase it is out of scope. | ||
defaultConfig.module.rules.forEach(rule => { | ||
if ('.jsx'.match(rule.test)) { | ||
if (rule.include) { | ||
rule.include.push(path.resolve(__dirname, '../../table/src')) | ||
rule.include.push(path.resolve(__dirname, '../../web/src')) | ||
} | ||
if (rule.exclude) { | ||
rule.exclude.push(path.resolve(__dirname, '../../table/node_modules')) | ||
rule.exclude.push(path.resolve(__dirname, '../../web/node_modules')) | ||
} | ||
} | ||
defaultConfig.resolve.alias = { | ||
...defaultConfig.resolve.alias, | ||
'styled-components': path.resolve(appFolder, 'node_modules', 'styled-components'), | ||
} | ||
}); | ||
|
||
return defaultConfig; | ||
}; |
File renamed without changes.
File renamed without changes.
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,31 @@ | ||
{ | ||
"name": "@gssfed/playground", | ||
"version": "0.0.1", | ||
"description": "gssfed playground", | ||
"private": true, | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "NODE_ENV='test' jest", | ||
"start": "start-storybook -p 6006" | ||
}, | ||
"author": "Eric Yip (https://github.com/ericyip)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@storybook/react": "3.4.6", | ||
"babel-plugin-styled-components": "1.5.1" | ||
}, | ||
"dependencies": { | ||
"faker": "^4.1.0" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.jsx$": "babel-jest", | ||
"^.+\\.js$": "babel-jest", | ||
"^.+\\.md?$": "markdown-loader-jest" | ||
}, | ||
"moduleNameMapper": { | ||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js", | ||
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js" | ||
} | ||
} | ||
} |
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
File renamed without changes.
9 changes: 6 additions & 3 deletions
9
packages/web/stories/Container/Section.js → .../playground/stories/Container/Section.jsx
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
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
Oops, something went wrong.