This commit is contained in:
Dominik Prokop 2019-01-09 09:40:57 +01:00
parent a9808ef518
commit 0fb23bd334
7 changed files with 3792 additions and 1387 deletions

View File

@ -0,0 +1,11 @@
import { configure } from '@storybook/react';
import '../../../public/sass/grafana.dark.scss';
// automatically import all files ending in *.stories.tsx
const req = require.context('../stories', true, /.story.tsx$/);
function loadStories() {
req.keys().forEach(req);
}
configure(loadStories, module);

View File

@ -0,0 +1,43 @@
const path = require('path');
module.exports = (baseConfig, env, config) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: require.resolve('awesome-typescript-loader'),
},
],
});
config.module.rules.push({
test: /\.scss$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
importLoaders: 2,
url: false,
sourceMap: false,
minimize: false,
},
},
{
loader: 'postcss-loader',
options: {
sourceMap: false,
config: { path: __dirname + '../../../../scripts/webpack/postcss.config.js' },
},
},
{ loader: 'sass-loader', options: { sourceMap: false } },
],
});
config.module.rules.push({
test: /\.(png|jpg|gif|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
loader: 'file-loader',
});
config.resolve.extensions.push('.ts', '.tsx');
return config;
};

View File

@ -5,7 +5,8 @@
"main": "src/index.ts",
"scripts": {
"tslint": "tslint -c tslint.json --project tsconfig.json",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"storybook": "start-storybook -p 9001 -c .storybook"
},
"author": "",
"license": "ISC",
@ -23,11 +24,20 @@
"react-virtualized": "^9.21.0"
},
"devDependencies": {
"@types/jest": "^23.3.2",
"@types/lodash": "^4.14.119",
"@types/react": "^16.7.6",
"@storybook/addon-info": "^4.1.4",
"@storybook/react": "^4.1.4",
"@types/classnames": "^2.2.6",
"@types/jest": "^23.3.2",
"@types/jquery": "^1.10.35",
"@types/lodash": "^4.14.119",
"@types/node": "^10.12.18",
"@types/react": "^16.7.6",
"@types/storybook__react": "^4.0.0",
"awesome-typescript-loader": "^5.2.1",
"react-docgen-typescript-webpack-plugin": "^1.1.0",
"typescript": "^3.2.2"
},
"resolutions": {
"@types/lodash": "4.14.119"
}
}

View File

@ -0,0 +1,11 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { DeleteButton } from '@grafana/ui';
storiesOf('Test story', module)
.addDecorator((story) => (
<div style={{padding: '20px'}}>{story()}</div>
))
.add('with text', () => {
return <DeleteButton onConfirm={() => { }}></DeleteButton>;
});

View File

@ -5,14 +5,17 @@
"src/**/*.tsx"
],
"exclude": [
"dist"
"dist",
"node_modules"
],
"compilerOptions": {
"rootDir": ".",
"rootDirs": [".", "stories"],
"module": "esnext",
"outDir": "dist",
"declaration": true,
"noImplicitAny": true,
"strictNullChecks": true
}
"strictNullChecks": true,
"typeRoots": ["./node_modules/@types", "types"],
"skipLibCheck": true // Temp workaround for Duplicate identifier tsc errors
},
}

View File

@ -4,7 +4,7 @@
"outDir": "public/dist",
"target": "es5",
"lib": ["es6", "dom"],
"rootDir": "public/",
"rootDirs": ["public/"],
"jsx": "react",
"module": "esnext",
"declaration": false,

5083
yarn.lock

File diff suppressed because it is too large Load Diff