Skip to content

Commit

Permalink
fix(gatsby-theme-docz): make Props isToggle work again (#1326)
Browse files Browse the repository at this point in the history
  • Loading branch information
gogoyqj authored and rakannimer committed Dec 16, 2019
1 parent a3f8d58 commit 4921ef5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/gatsby-theme-docz/src/components/Props/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 (
<div sx={styles.container} data-testid="props">
{entries.map(([key, prop]) => (
<Prop key={key} propName={key} prop={prop} getPropType={getPropType} />
<Prop key={key} propName={key} prop={prop} getPropType={getPropType} isToggle={isToggle} />
))}
</div>
)
Expand Down

0 comments on commit 4921ef5

Please sign in to comment.