Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7588 from blink1073/storybook-ui-extensions
Add storybook to ui-components
- Loading branch information
Showing
10 changed files
with
3,069 additions
and
100 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,5 @@ | ||
import { configure } from '@storybook/react'; | ||
|
||
const req = require.context('../stories', true, /.stories.tsx$/); | ||
|
||
configure(req, module); |
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,15 @@ | ||
{ | ||
"extends": "../../../tsconfigbase.json", | ||
"compilerOptions": { | ||
"lib": ["es6", "dom"], | ||
"allowJs": false, | ||
"rootDir": "../", | ||
"outDir": "dist", | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"skipLibCheck": true | ||
}, | ||
"include": ["../src/**/*"], | ||
"exclude": ["node_modules"] | ||
} |
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,36 @@ | ||
const path = require('path'); | ||
const SRC_PATH = path.join(__dirname, '../src'); | ||
const STORIES_PATH = path.join(__dirname, '../stories'); | ||
const STYLE_PATH = path.resolve(__dirname, '../style'); | ||
|
||
//dont need stories path if you have your stories inside your src folder | ||
module.exports = ({ config }) => { | ||
config.module.rules.push({ | ||
test: /\.(ts|tsx)$/, | ||
include: [SRC_PATH, STORIES_PATH], | ||
use: [ | ||
{ | ||
loader: require.resolve('awesome-typescript-loader'), | ||
options: { | ||
configFileName: './.storybook/tsconfig.json' | ||
} | ||
}, | ||
{ loader: require.resolve('react-docgen-typescript-loader') } | ||
] | ||
}); | ||
|
||
const fileLoaderRule = config.module.rules.find(rule => | ||
rule.test.test('.svg') | ||
); | ||
fileLoaderRule.exclude = STYLE_PATH; | ||
config.module.rules.push({ | ||
test: /\.svg$/, | ||
include: STYLE_PATH, | ||
// issuer: { test: /\.ts$/ }, | ||
use: { | ||
loader: 'raw-loader' | ||
} | ||
}); | ||
config.resolve.extensions.push('.ts', '.tsx'); | ||
return 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,12 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
targets: { | ||
node: 'current' | ||
} | ||
} | ||
] | ||
] | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Example story for styling a button. | ||
*/ | ||
import React from 'react'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
import { Button } from '../src'; | ||
|
||
import '@jupyterlab/application/style/index.css'; | ||
import '@jupyterlab/theme-light-extension/style/index.css'; | ||
|
||
export default { | ||
component: Button, | ||
title: 'Button' | ||
}; | ||
|
||
export const text = () => ( | ||
<Button onClick={action('clicked')}>Hello Button</Button> | ||
); | ||
|
||
export const emoji = () => ( | ||
<Button onClick={action('clicked')}> | ||
<span role="img" aria-label="so cool"> | ||
😀 😎 👍 💯 | ||
</span> | ||
</Button> | ||
); |
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,24 @@ | ||
/** | ||
* Example story for styling an icon. | ||
*/ | ||
// need this to avoid | ||
// TS2686: 'React' refers to a UMD global, but the current file is a module. | ||
import React from 'react'; | ||
|
||
import { DefaultIconReact } from '../src'; | ||
|
||
import '@jupyterlab/application/style/index.css'; | ||
import '@jupyterlab/theme-light-extension/style/index.css'; | ||
|
||
export default { | ||
component: DefaultIconReact, | ||
title: 'IconReact' | ||
}; | ||
|
||
export const buildIcon = () => <DefaultIconReact name={'build'} />; | ||
|
||
export const html5Icon = () => ( | ||
<div className={'foobar'}> | ||
<DefaultIconReact name={'html5'} kind={'launcherSection'} center={true} /> | ||
</div> | ||
); |
Oops, something went wrong.