Skip to content

Commit

Permalink
added height props to toggle (#3257)
Browse files Browse the repository at this point in the history
Thanks for the port!
  • Loading branch information
yathomasi authored Feb 9, 2022
1 parent 74eacba commit 08398dd
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ const ToggleTab: React.FC<{
}

const Toggle: React.FC<{
height?: string
children: Array<{ props: { title: string } } | string>
}> = ({ children }) => {
}> = ({ height, children }) => {
const [toggleId, setToggleId] = useState('')
const {
addNewToggle = (): null => null,
Expand Down Expand Up @@ -181,17 +182,20 @@ const Toggle: React.FC<{
}
onChange={(): void => updateToggleInd(toggleId, i)}
>
{tab}
<div
className={cn('tab', styles.tab)}
style={{
minHeight: height
}}
>
{tab}
</div>
</ToggleTab>
))}
</div>
)
}

const Tab: React.FC = ({ children }) => (
<div className={cn('tab', styles.tab)}>{children}</div>
)

// Rehype's typedefs don't allow for custom components, even though they work
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const renderAst = new (rehypeReact as any)({
Expand All @@ -204,7 +208,7 @@ const renderAst = new (rehypeReact as any)({
cards: Cards,
details: Details,
toggle: Toggle,
tab: Tab
tab: React.Fragment
}
}).Compiler

Expand Down

0 comments on commit 08398dd

Please sign in to comment.