From 4921ef5f9d9ecddc2e81ce9c05666269e493e7f4 Mon Sep 17 00:00:00 2001 From: skipper Date: Mon, 16 Dec 2019 18:58:53 +0800 Subject: [PATCH] fix(gatsby-theme-docz): make Props isToggle work again (#1326) --- core/gatsby-theme-docz/src/components/Props/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/gatsby-theme-docz/src/components/Props/index.js b/core/gatsby-theme-docz/src/components/Props/index.js index 72e276a2c..00ed7d210 100644 --- a/core/gatsby-theme-docz/src/components/Props/index.js +++ b/core/gatsby-theme-docz/src/components/Props/index.js @@ -20,8 +20,8 @@ export const getDefaultValue = ({ defaultValue, type, flowType }) => { return defaultValue.value } -export const Prop = ({ propName, prop, getPropType }) => { - const [showing, setShowing] = useState(false) +export const Prop = ({ propName, prop, getPropType, isToggle }) => { + const [showing, setShowing] = useState(isToggle || false) if (!prop.type && !prop.flowType) return null const toggle = () => setShowing(s => !s) @@ -65,13 +65,13 @@ export const Prop = ({ propName, prop, getPropType }) => { ) } -export const Props = ({ props, getPropType }) => { +export const Props = ({ props, getPropType, isToggle }) => { const entries = Object.entries(props) return (
{entries.map(([key, prop]) => ( - + ))}
)