mirror of
https://github.com/zhigang1992/docz.git
synced 2026-04-29 09:55:55 +08:00
chore(docz-core): use findAllExportedComponentDefinitions for react-docgen
This commit is contained in:
@@ -17,7 +17,7 @@ const AlertStyled = styled('div')`
|
||||
background: ${({ kind = 'info' }) => kinds[kind]};
|
||||
`
|
||||
|
||||
const Alert = props => <AlertStyled {...props} />
|
||||
export const Alert = props => <AlertStyled {...props} />
|
||||
|
||||
Alert.propTypes = {
|
||||
kind: t.oneOf(['info', 'positive', 'negative', 'warning']),
|
||||
@@ -26,5 +26,3 @@ Alert.propTypes = {
|
||||
Alert.defaultProps = {
|
||||
kind: 'info',
|
||||
}
|
||||
|
||||
export default Alert
|
||||
|
||||
@@ -4,7 +4,7 @@ menu: Components
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from 'docz'
|
||||
import Alert from './Alert'
|
||||
import { Alert } from './Alert'
|
||||
|
||||
# Alert
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ const ButtonStyled = styled('button')`
|
||||
border-radius: 3px;
|
||||
`
|
||||
|
||||
const Button = ({ children, ...props }) => (
|
||||
export const Button = ({ children, ...props }) => (
|
||||
<ButtonStyled {...props}>{children}</ButtonStyled>
|
||||
)
|
||||
|
||||
@@ -73,5 +73,3 @@ Button.defaultProps = {
|
||||
kind: 'primary',
|
||||
outline: false,
|
||||
}
|
||||
|
||||
export default Button
|
||||
|
||||
@@ -4,7 +4,7 @@ menu: Components
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from 'docz'
|
||||
import Button from './Button'
|
||||
import { Button } from './Button'
|
||||
|
||||
# Button
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ const AlertStyled = styled('div')`
|
||||
background: ${({ kind = 'info' }) => kinds[kind]};
|
||||
`
|
||||
|
||||
const Alert = props => <AlertStyled {...props} />
|
||||
export const Alert = props => <AlertStyled {...props} />
|
||||
|
||||
Alert.propTypes = {
|
||||
kind: t.oneOf(['info', 'positive', 'negative', 'warning']),
|
||||
@@ -26,5 +26,3 @@ Alert.propTypes = {
|
||||
Alert.defaultProps = {
|
||||
kind: 'info',
|
||||
}
|
||||
|
||||
export default Alert
|
||||
|
||||
@@ -4,7 +4,7 @@ menu: Components
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from 'docz'
|
||||
import Alert from './Alert'
|
||||
import { Alert } from './Alert'
|
||||
|
||||
# Alert
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ const ButtonStyled = styled('button')`
|
||||
border-radius: 3px;
|
||||
`
|
||||
|
||||
const Button = ({ children, ...props }) => (
|
||||
export const Button = ({ children, ...props }) => (
|
||||
<ButtonStyled {...props}>{children}</ButtonStyled>
|
||||
)
|
||||
|
||||
@@ -73,5 +73,3 @@ Button.defaultProps = {
|
||||
kind: 'primary',
|
||||
outline: false,
|
||||
}
|
||||
|
||||
export default Button
|
||||
|
||||
@@ -4,7 +4,7 @@ menu: Components
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from 'docz'
|
||||
import Button from './Button'
|
||||
import { Button } from './Button'
|
||||
|
||||
# Button
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@ const AlertStyled = styled('div')`
|
||||
background: ${({ kind = 'info' }) => kinds[kind]};
|
||||
`
|
||||
|
||||
const Alert = ({ kind = 'info', ...props }: AlertProps) => (
|
||||
export const Alert = ({ kind = 'info', ...props }: AlertProps) => (
|
||||
<AlertStyled {...props} kind={kind} />
|
||||
)
|
||||
|
||||
export default Alert
|
||||
|
||||
@@ -4,7 +4,7 @@ menu: Components
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from 'docz'
|
||||
import Alert from './Alert'
|
||||
import { Alert } from './Alert'
|
||||
|
||||
# Alert
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ type ButtonProps = {
|
||||
children: Node,
|
||||
}
|
||||
|
||||
const Button = ({
|
||||
export const Button = ({
|
||||
scale = 'normal',
|
||||
kind = 'primary',
|
||||
outline = false,
|
||||
@@ -75,5 +75,3 @@ const Button = ({
|
||||
{children}
|
||||
</ButtonStyled>
|
||||
)
|
||||
|
||||
export default Button
|
||||
|
||||
@@ -4,7 +4,7 @@ menu: Components
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from 'docz'
|
||||
import Button from './Button'
|
||||
import { Button } from './Button'
|
||||
|
||||
# Button
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ menu: Components
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from 'docz'
|
||||
import Alert from './Alert'
|
||||
import { Alert } from './Alert'
|
||||
|
||||
# Alert
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@ const AlertStyled = styled('div')`
|
||||
background: ${({ kind = 'info' }: AlertProps) => kinds[kind]};
|
||||
`
|
||||
|
||||
const Alert: SFC<AlertProps> = ({ kind, ...props }) => (
|
||||
export const Alert: SFC<AlertProps> = ({ kind, ...props }) => (
|
||||
<AlertStyled {...props} kind={kind} />
|
||||
)
|
||||
|
||||
export default Alert
|
||||
|
||||
@@ -4,7 +4,7 @@ menu: Components
|
||||
---
|
||||
|
||||
import { Playground, PropsTable } from 'docz'
|
||||
import Button from './Button'
|
||||
import { Button } from './Button'
|
||||
|
||||
# Button
|
||||
|
||||
|
||||
@@ -67,8 +67,6 @@ const ButtonStyled = styled('button')`
|
||||
border-radius: 3px;
|
||||
`
|
||||
|
||||
const Button: SFC<ButtonProps> = ({ children, ...props }) => (
|
||||
export const Button: SFC<ButtonProps> = ({ children, ...props }) => (
|
||||
<ButtonStyled {...props}>{children}</ButtonStyled>
|
||||
)
|
||||
|
||||
export default Button
|
||||
|
||||
@@ -27,9 +27,10 @@ export const setupHappypack = (config: Config, args: Args, babelrc: any) => {
|
||||
}
|
||||
|
||||
if (args.propsParser && !args.typescript) {
|
||||
babelLoader.options.plugins.push(
|
||||
require.resolve('babel-plugin-react-docgen')
|
||||
)
|
||||
babelLoader.options.plugins.push([
|
||||
require.resolve('babel-plugin-react-docgen'),
|
||||
{ resolver: 'findAllExportedComponentDefinitions' },
|
||||
])
|
||||
}
|
||||
|
||||
if (args.propsParser && args.typescript) {
|
||||
|
||||
Reference in New Issue
Block a user