Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

feat(docz-theme-default): add options to the props component #823

Merged
merged 1 commit into from
Apr 24, 2019

Conversation

ivan-dalmet
Copy link
Contributor

@ivan-dalmet ivan-dalmet commented Apr 21, 2019

Proposition

With the version 1.0 of Docz, the display of props with the <Props> component is a little rough.
(https://spectrum.chat/docz/general/please-bring-back-the-props-table-ui~7ebcbebf-137f-43fe-91f1-e4de8e8e0e2a)

The idea is to provide a more clean way to display props out of the box.

image

I introduce 3 new props for the <Props> component:

Prop Type  Description
isRaw boolean Display props as now in Docz 
isToggle boolean Allow to collapse props 
title node Display a title before the props (this is also the title for the toggle) 

I also introduce 2 colors in the default theme: propsText & propsBg.

It's my first time with CSS in JS and styled-components so feel free to challenge the code ;)

So the result looks like that:

Code <Props of={Button} />
Result image
Code <Props of={Button} isRaw />
Result image
Code <Props of={Button} isToggle title="⚛️ Button props" />
Result props-toggle

Dark mode render
image

Responsive render
image

Todo

  • Update documentation

Pre-merge checklist

  • Review the Code
  • Review the CSS (it's my first time with CSS in JS)

Feel free to say if it's not a good idea or if this can be done with a better way ;)

@pedronauck
Copy link
Member

Awesome @ivan-dalmet, I'm reviewing this in order to merge it, thanks!

@pedronauck pedronauck merged commit 9edaac8 into master Apr 24, 2019
@pedronauck pedronauck deleted the feat/props-display-options branch April 24, 2019 21:02
@drewlustro
Copy link

Fantastic!

@crazyxhz
Copy link

crazyxhz commented May 4, 2019

image

If a prop is required and has a default value, it has some style issue. Besides can we display a title row like: propName / type/ defaultValue/ description / isRequired instead of the less obvious "=xxx" syntax?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants