Commit ffbe161d authored by Yannis Barlas's avatar Yannis Barlas Committed by Alexandros Georgantas
Browse files

Storybook init

parent fe195b53
!.storybook
\ No newline at end of file
{
"parser": "babel-eslint",
"env": {
"es6": true,
"browser": true
},
"extends": "pubsweet",
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [".storybook/**", "src/stories/**"]
}
]
}
}
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
\ No newline at end of file
{
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
import 'storybook-addon-styled-component-theme/dist/src/register'
import '@storybook/addon-a11y/register'
import '@storybook/addon-knobs/register'
import '@storybook/addon-actions/register'
import { addDecorator, configure } from '@storybook/react'
import { withA11y } from '@storybook/addon-a11y'
import { withInfo } from '@storybook/addon-info'
import { withKnobs } from '@storybook/addon-knobs'
// import { withSmartKnobs } from 'storybook-addon-smart-knobs'
import { withThemesProvider } from 'storybook-addon-styled-component-theme'
import cokoTheme from '@pubsweet/coko-theme'
// TODO: Should be moved to theme's repo
cokoTheme.name = 'Coko theme'
const themes = [cokoTheme]
configure(require.context('../src/stories', true, /\.stories\.js$/), module)
addDecorator(withInfo)
addDecorator(withA11y)
// addDecorator(withSmartKnobs)
addDecorator(withKnobs)
addDecorator(withThemesProvider(themes))
const path = require('path')
module.exports = async ({ config }) => {
if (config.name !== 'manager') {
const jsLoader = config.module.rules.find(
rule => rule.use[0].loader === 'babel-loader',
)
const UILocation = path.join(__dirname, '..', 'src')
const pubsweetUILocation = path.join(
__dirname,
'..',
'node_modules',
'@pubsweet',
'ui',
)
jsLoader.include = [UILocation, pubsweetUILocation]
jsLoader.exclude = []
}
return config
}
{
"extends": [
"stylelint-config-recommended",
"stylelint-config-styled-components"
],
"plugins": ["stylelint-order"],
"processors": ["stylelint-processor-styled-components"],
"rules": {
"order/order": ["declarations", "rules", "at-rules"],
"order/properties-alphabetical-order": true
}
}
import React from 'react'
import { Button } from '../ui'
export const Primary = () => <Button primary>Hello th sdfgzsdfgdgsfis</Button>
export const PrimaryDisabled = () => (
<Button disabled primary>
Hello th sdfgzsdfgdgsfis
</Button>
)
export const Secondary = () => <Button>Hello</Button>
export default { title: 'Button' }
import React from 'react'
import PropTypes from 'prop-types'
import { Button as UIButton } from '@pubsweet/ui'
const Button = ({ children, ...props }) => (
<UIButton {...props}>{children}</UIButton>
)
Button.propTypes = {
/** The contents of the button (text, icon etc.) */
children: PropTypes.node.isRequired,
/** ID to be used in test selectors */
'data-test-id': PropTypes.string,
/** Makes button a primary button */
primary: PropTypes.bool,
}
Button.defaultProps = {
'data-test-id': 'button',
primary: false,
}
export default Button
export { default as Button } from './Button'
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment