-
Notifications
You must be signed in to change notification settings - Fork 59
feat: component docs styles tab #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🟡 Heimdall Review Status
🟡
|
| Code Owner | Status | Calculation | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ui-systems-eng-team |
🟡
0/1
|
Denominator calculation
|
| | `titleStackContainer` | Container wrapping titleStack | | ||
| | `topContent` | Top section content | | ||
| | `track` | Track/rail element (in progress bars, sliders) | | ||
| | `trigger` | Trigger element that opens a dropdown/popover | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we have discussed potential concern over having a wide range of style names for similar sub-elements so keeping a list should help with this
packages/mobile/src/chips/Chip.tsx
Outdated
| import { Text } from '../typography/Text'; | ||
|
|
||
| import type { ChipProps } from './ChipProps'; | ||
| export type { ChipProps } from './ChipProps'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For docgen to pick this up we need to export it from the file. This will also allow us to be more consisent with other components.
| export type StylesAndClassNames<ComponentClassNamesMap extends Record<string, string>> = { | ||
| classNames?: { [key in keyof ComponentClassNamesMap]?: string }; | ||
| styles?: { [key in keyof ComponentClassNamesMap]?: React.CSSProperties }; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what y'all think about this for web. It allows us to keep the keys consistent across classNames, styles, and static classNames. We still haven't decided if we want static classNames for everything but we could start applying to some components now.
I tested this with NavigationBar.
|
|
||
| ## Selectors | ||
|
|
||
| <ComponentStylesTable componentName="ContentCell" styles={mobileStylesData} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hcopp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested all the docs
| media={<Avatar size="m" />} | ||
| /> | ||
| )} | ||
| </StylesExplorer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| ## Selectors | ||
|
|
||
| <ComponentStylesTable componentName="ListCell" styles={mobileStylesData} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
| /> | ||
| )} | ||
| </StylesExplorer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| ## Selectors | ||
|
|
||
| <ComponentStylesTable componentName="ProgressBar" styles={mobileStylesData} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| <StylesExplorer selectors={webStylesData.selectors}> | ||
| {(classNames) => <ProgressBar progress={0.65} classNames={classNames} />} | ||
| </StylesExplorer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| <StylesExplorer selectors={webStylesData.selectors}> | ||
| {(classNames) => <SidebarExample classNames={classNames} />} | ||
| </StylesExplorer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| <StylesExplorer selectors={webStylesData.selectors}> | ||
| {(classNames) => <StepperExample classNames={classNames} direction="vertical" />} | ||
| </StylesExplorer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <IconButton name="bell" /> | ||
| </DotCount> | ||
| )} | ||
| </StylesExplorer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| </Box> | ||
| </VStack> | ||
| ); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the design of component props table
| </Box> | ||
| </VStack> | ||
| ); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't have a ton to go off here, I choose to do background of bg to match our code examples. I initially tried setting the sidebar of selectors to match table colors (so gray10 for the top part and then no extra background for the list cells) but this current setup was the one that looked the best to me.
|
I'll wait to bump versions since this PR might not get merged for a bit |









What changed? Why?
This PR adds
Future tasks
Styles tab
Selectors
This table is generated by docgen by trying to select the styles prop from a component. It also looks for this new StylesAndClassNames
it uses these values to display one of two tables
Explorer (web only)
The code example is generated by AI and paired with the same selectors from above to let the user highlight
It also works with SVG components

UI
Carousel Web
Carousel Mobile
Other library implementations
Ant
Mantine
Testing
Tested all of these components manually
How has it been tested?
Testing instructions
Illustrations/Icons Checklist
Required if this PR changes files under
packages/illustrations/**orpackages/icons/**Change management
type=routine
risk=low
impact=sev5
automerge=false