Skip to content

Commit

Permalink
feat: **BREAKING!** enable mobile toc through legacyToc prop
Browse files Browse the repository at this point in the history
  • Loading branch information
martyanovandrey committed Nov 6, 2024
1 parent 02867e3 commit f40425d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/DocLayout/DocLayout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@
}
}

&__legacy-toc {
position: static;
left: auto;
width: 100%;

border-right: none;
}

&__toc {
position: static;
width: 100%;
Expand Down
4 changes: 3 additions & 1 deletion src/components/DocLayout/DocLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface DocLayoutProps {
loading?: boolean;
footer?: React.ReactNode;
singlePage?: boolean;
legacyToc?: boolean;
onChangeSinglePage?: (value: boolean) => void;
pdfLink?: string;
}
Expand All @@ -46,6 +47,7 @@ export class DocLayout extends React.Component<DocLayoutProps> {
hideRight = false,
loading = false,
footer = null,
legacyToc = false,
} = this.props;
let left, center, right;
const modes = {
Expand Down Expand Up @@ -78,7 +80,7 @@ export class DocLayout extends React.Component<DocLayoutProps> {
{/* layout direction reverses on mobiles */}
<div className={b('mobile-only')}>{footer}</div>
{fullScreen ? null : (
<div className={b('left', modes)}>
<div className={b('left', modes, legacyToc ? b('legacy-toc') : undefined)}>
{this.renderToc()}
{left}
</div>
Expand Down

0 comments on commit f40425d

Please sign in to comment.