New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow user to set TOC display preference #6786
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start! The right side position does have some layout issues though and easily gets obscured by having the comment or history sidebar open.
@@ -276,6 +282,31 @@ function Details() { | |||
/> | |||
</SettingRow> | |||
|
|||
<SettingRow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets move this under the "Display" header, it's currently under "Behavior"
@@ -276,6 +282,31 @@ function Details() { | |||
/> | |||
</SettingRow> | |||
|
|||
<SettingRow | |||
border={false} | |||
label={t("Table of Contents Position")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label={t("Table of Contents Position")} | |
label={t("Table of Contents position")} |
)} | ||
> | ||
<InputSelect | ||
ariaLabel={t("TOC position")} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ariaLabel={t("TOC position")} | |
ariaLabel={t("Table of Contents position")} |
ariaLabel={t("TOC position")} | ||
options={[ | ||
{ | ||
label: "Left", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label: "Left", | |
label: t("Left"), |
value: TOCPosition.Left, | ||
}, | ||
{ | ||
label: "Right", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label: "Right", | |
label: t("Right"), |
}, | ||
]} | ||
value={tocPosition} | ||
onChange={(p: TOCPosition) => setTocPosition(p)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onChange={(p: TOCPosition) => setTocPosition(p)} | |
onChange={setTocPosition} |
Should work, no? Or is typescript forcing the intermediate function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, Typescript 😅 .
@@ -540,6 +542,7 @@ class DocumentScene extends React.Component<Props> { | |||
<Contents | |||
headings={this.headings} | |||
isFullWidth={document.fullWidth} | |||
onLeftSide={tocOnLeftSide} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onLeftSide={tocOnLeftSide} | |
position={position} |
Lets continue to pass position
down
Ohh.. Sorry, I missed testing the layout shifts with the sidebar open. |
Give it a go, honestly how the sidebar lives in the dom might just need rethinking – it's not especially great on the left side either :( There's a lot of complexity as it tries to keep the document content centered until there's no longer room and then moves to keeping the toc+document centered. |
When the sidebar is open, I don't find the TOC being obscured; however I do find layout shifts, no matter the display preference. |
Closes #6383