doczjs / docz

✍ It has never been so easy to document your things!
https://docz.site
MIT License
23.63k stars 1.46k forks source link

need a prop to set default visibility of props descriptions version 2+ #1323

Closed gogoyqj closed 4 years ago

gogoyqj commented 4 years ago

Question

seems a props form Props component is needed to control default visibility of props‘s descriptions

image

seems that isToggle means to do it but actually not

<Props isToggle of={ComponentXX} />

https://github.com/doczjs/docz/blob/320f5c4ad8be1835cbc8498cee1dcb41afee0c85/core/docz/src/components/Props.tsx#L161

rakannimer commented 4 years ago

Hey @gogoyqj

Thanks for reporting this issue. You're right it looks like isToggle is not being used in v2.

To fix it we would need to

  1. Add isToggle argument in Props definition : https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/components/Props/index.js#L68
  2. Pass isToggle down to Prop https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/components/Props/index.js#L74
  3. Add isToggle argument in Prop definition : https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/components/Props/index.js#L23
  4. Initialize showing state to isToggle https://github.com/doczjs/docz/blob/master/core/gatsby-theme-docz/src/components/Props/index.js#L24

PRs are very welcome if someone would like to take a shot at it.

If not I'll try to get to it as soon as possible 👍

gogoyqj commented 4 years ago

@rakannimer i'd like to fix it and then make a pr today