Skip to content

Commit

Permalink
feat(docz): spread remaining props to Props component (#1276)
Browse files Browse the repository at this point in the history
This commit spreads the remaining props to the user provided `Props`
component. This way, the user can pass custom properties from MDX to
their custom implementation or shadowed component.
  • Loading branch information
selbekk authored and rakannimer committed Nov 26, 2019
1 parent bbe780c commit 531244f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/docz/src/components/Props.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface PropsProps {
isRaw?: boolean
isToggle?: boolean
of: ComponentWithDocGenInfo
[key: string]: any
}

export const getPropType = (prop: Prop) => {
Expand Down Expand Up @@ -98,13 +99,15 @@ export interface PropsComponentProps {
props: Record<string, Prop>
getPropType(prop: Prop): string
of: ComponentWithDocGenInfo
[key: string]: any
}

export const Props: SFC<PropsProps> = ({
title,
isToggle,
isRaw,
of: component,
...rest
}) => {
const components = useComponents()
const { props: stateProps } = React.useContext(doczState.context)
Expand Down Expand Up @@ -151,6 +154,7 @@ export const Props: SFC<PropsProps> = ({
props={props}
getPropType={getPropType}
of={component}
{...rest}
/>
)
}

0 comments on commit 531244f

Please sign in to comment.