Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hmacr
Copy link
Contributor

@hmacr hmacr commented Apr 10, 2024

Closes #6383

@auto-assign auto-assign bot requested a review from tommoor April 10, 2024 12:45
Copy link
Member

@tommoor tommoor left a 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
Copy link
Member

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")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label={t("Table of Contents Position")}
label={t("Table of Contents position")}

)}
>
<InputSelect
ariaLabel={t("TOC position")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ariaLabel={t("TOC position")}
ariaLabel={t("Table of Contents position")}

ariaLabel={t("TOC position")}
options={[
{
label: "Left",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label: "Left",
label: t("Left"),

value: TOCPosition.Left,
},
{
label: "Right",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label: "Right",
label: t("Right"),

},
]}
value={tocPosition}
onChange={(p: TOCPosition) => setTocPosition(p)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onChange={(p: TOCPosition) => setTocPosition(p)}
onChange={setTocPosition}

Should work, no? Or is typescript forcing the intermediate function

Copy link
Contributor Author

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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onLeftSide={tocOnLeftSide}
position={position}

Lets continue to pass position down

@hmacr
Copy link
Contributor Author

hmacr commented Apr 12, 2024

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.

Ohh.. Sorry, I missed testing the layout shifts with the sidebar open.
Let me update the code.

@tommoor
Copy link
Member

tommoor commented Apr 12, 2024

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.

@hmacr
Copy link
Contributor Author

hmacr commented Apr 12, 2024

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.

When the sidebar is open, I don't find the TOC being obscured; however I do find layout shifts, no matter the display preference.
Let me redesign the document layout to fix them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add display preference to move document TOC to right hand side
2 participants