Add typings for @storybook/addon-backgrounds

This commit is contained in:
HyunSeob
2017-12-20 11:30:45 +09:00
parent 57c75d8b4d
commit 4d35d9e980
4 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
// Type definitions for @storybook/addon-backgrounds 3.2
// Project: https://github.com/storybooks/storybook
// Definitions by: HyunSeob <https://github.com/hyunseob>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import { StoryDecorator } from '@storybook/react';
export interface Background {
name: string;
value: string;
default?: boolean;
}
declare function backgrounds(backgrounds: Background[]): StoryDecorator;
export default backgrounds;

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import backgrounds from '@storybook/addon-backgrounds';
storiesOf('Text', module)
.addDecorator(
backgrounds([
{
name: 'white',
value: '#fff',
default: true
},
{
name: 'black',
value: '#000'
}
])
)
.add('default', () => <p>This is just sample.</p>);

View File

@@ -0,0 +1,32 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": [
"../"
],
"paths": {
"@storybook/addon-backgrounds": [
"storybook__addon-backgrounds"
],
"@storybook/react": [
"storybook__react"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"storybook__addon-backgrounds-tests.tsx"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }