mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 14:25:38 -04: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
frontend
global-styles
src/components/render-page/renderers/document
|
@ -30,18 +30,6 @@ body {
|
||||||
background-color: $dark;
|
background-color: $dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
#__next {
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
*:focus {
|
*:focus {
|
||||||
outline: 0 !important;
|
outline: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ export const DocumentTocSidebar: React.FC<DocumentTocSidebarProps> = ({ width, b
|
||||||
const [tocAst, setTocAst] = useState<TocAst>()
|
const [tocAst, setTocAst] = useState<TocAst>()
|
||||||
useExtensionEventEmitterHandler(TableOfContentsMarkdownExtension.EVENT_NAME, setTocAst)
|
useExtensionEventEmitterHandler(TableOfContentsMarkdownExtension.EVENT_NAME, setTocAst)
|
||||||
return (
|
return (
|
||||||
<div className={`${styles['markdown-document-side']} pt-4`}>
|
<div className={styles['markdown-document-side']}>
|
||||||
<ShowIf condition={!!tocAst}>
|
<ShowIf condition={!!tocAst}>
|
||||||
<WidthBasedTableOfContents tocAst={tocAst as TocAst} baseUrl={baseUrl} width={width} />
|
<WidthBasedTableOfContents tocAst={tocAst as TocAst} baseUrl={baseUrl} width={width} />
|
||||||
</ShowIf>
|
</ShowIf>
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
.markdown-document-side {
|
.markdown-document-side {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
flex: 1 0 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 }) => {
|
export const WidthBasedTableOfContents: React.FC<DocumentExternalTocProps> = ({ tocAst, width, baseUrl }) => {
|
||||||
if (width >= MAX_WIDTH_FOR_BUTTON_VISIBILITY) {
|
if (width >= MAX_WIDTH_FOR_BUTTON_VISIBILITY) {
|
||||||
return <TableOfContents ast={tocAst} className={'sticky'} baseUrl={baseUrl} />
|
return <TableOfContents ast={tocAst} baseUrl={baseUrl} />
|
||||||
} else {
|
} else {
|
||||||
return <TableOfContentsHoveringButton tocAst={tocAst} baseUrl={baseUrl} />
|
return <TableOfContentsHoveringButton tocAst={tocAst} baseUrl={baseUrl} />
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue