mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-22 23:42:15 +00:00
fix: sticky position of toc sidebar
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
60c7305719
commit
927193e4b9
4 changed files with 5 additions and 14 deletions
|
@ -30,18 +30,6 @@ body {
|
|||
background-color: $dark;
|
||||
}
|
||||
|
||||
#__next {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
*:focus {
|
||||
outline: 0 !important;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ export const DocumentTocSidebar: React.FC<DocumentTocSidebarProps> = ({ width, b
|
|||
const [tocAst, setTocAst] = useState<TocAst>()
|
||||
useExtensionEventEmitterHandler(TableOfContentsMarkdownExtension.EVENT_NAME, setTocAst)
|
||||
return (
|
||||
<div className={`${styles['markdown-document-side']} pt-4`}>
|
||||
<div className={styles['markdown-document-side']}>
|
||||
<ShowIf condition={!!tocAst}>
|
||||
<WidthBasedTableOfContents tocAst={tocAst as TocAst} baseUrl={baseUrl} width={width} />
|
||||
</ShowIf>
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
flex-direction: row;
|
||||
|
||||
.markdown-document-side {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
flex: 1 0 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ const MAX_WIDTH_FOR_BUTTON_VISIBILITY = 1100
|
|||
*/
|
||||
export const WidthBasedTableOfContents: React.FC<DocumentExternalTocProps> = ({ tocAst, width, baseUrl }) => {
|
||||
if (width >= MAX_WIDTH_FOR_BUTTON_VISIBILITY) {
|
||||
return <TableOfContents ast={tocAst} className={'sticky'} baseUrl={baseUrl} />
|
||||
return <TableOfContents ast={tocAst} baseUrl={baseUrl} />
|
||||
} else {
|
||||
return <TableOfContentsHoveringButton tocAst={tocAst} baseUrl={baseUrl} />
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue