-
Notifications
You must be signed in to change notification settings - Fork 31
Reformat "open in chatgpt" dropdown #3272
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fd35d53
revise dropdown implementation to use swizzling
paigecalvert b801dd5
edit approach to swizzle docitem/content
paigecalvert 28eac45
fix center alignment
paigecalvert ee1baca
remove commented out styles
paigecalvert 9f57411
remove debugging stuff
paigecalvert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| --- | ||
| slug: / | ||
| pagination_next: null | ||
| hide_table_of_contents: true | ||
| --- | ||
|
|
||
| # Home | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are legacy components from the default docusaurus site. we're not using them and they can be removed |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /** | ||
| * Copyright (c) Facebook, Inc. and its affiliates. | ||
| * | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
|
|
||
| import React, {type ReactNode} from 'react'; | ||
| import clsx from 'clsx'; | ||
| import {ThemeClassNames} from '@docusaurus/theme-common'; | ||
| import {useDoc} from '@docusaurus/plugin-content-docs/client'; | ||
| import Heading from '@theme/Heading'; | ||
| import MDXContent from '@theme/MDXContent'; | ||
| import type {Props} from '@theme/DocItem/Content'; | ||
| import CopyMarkdown from '../../../components/CopyMarkdown'; | ||
| import styles from './styles.module.css'; | ||
|
|
||
| /** | ||
| Title can be declared inside md content or declared through | ||
| front matter and added manually. To make both cases consistent, | ||
| the added title is added under the same div.markdown block | ||
| See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120 | ||
|
|
||
| We render a "synthetic title" if: | ||
| - user doesn't ask to hide it with front matter | ||
| - the markdown content does not already contain a top-level h1 heading | ||
| */ | ||
| function useSyntheticTitle(): string | null { | ||
| const {metadata, frontMatter, contentTitle} = useDoc(); | ||
| const shouldRender = | ||
| !frontMatter.hide_title && typeof contentTitle === 'undefined'; | ||
| if (!shouldRender) { | ||
| return null; | ||
| } | ||
| return metadata.title; | ||
| } | ||
|
|
||
| export default function DocItemContent({children}: Props): ReactNode { | ||
| const syntheticTitle = useSyntheticTitle(); | ||
| return ( | ||
| <div className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown', styles.docItemContainer)}> | ||
| <CopyMarkdown /> | ||
| {syntheticTitle && ( | ||
| <header> | ||
| <Heading as="h1">{syntheticTitle}</Heading> | ||
| </header> | ||
| )} | ||
| <MDXContent>{children}</MDXContent> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| .docHeader { | ||
| display: flex; | ||
| align-items: flex-start; | ||
| justify-content: space-between; | ||
| margin-bottom: 1.5rem; | ||
| flex-wrap: wrap; | ||
| gap: 1rem; | ||
| } | ||
|
|
||
| /* When there's no title, align the dropdown to the right */ | ||
| .docHeader:empty, | ||
| .docHeader:has(> :only-child) { | ||
| justify-content: flex-end; | ||
| } | ||
|
|
||
| .docTitle { | ||
| font-size: 2.5rem; | ||
| margin-bottom: 0; | ||
| margin-right: 0; | ||
| flex: 1 1 auto; | ||
| min-width: 0; | ||
| overflow-wrap: normal; | ||
| word-wrap: normal; | ||
| word-break: keep-all; | ||
| hyphens: none; | ||
| max-width: calc(100% - 180px); | ||
| line-height: 1.2; | ||
| } | ||
|
|
||
| .docItemContainer { | ||
| position: relative; | ||
| } | ||
|
|
||
| /* Position the CopyMarkdown component relative to the first h1 */ | ||
| .docItemContainer :global(.copy-markdown-container) { | ||
| position: absolute; | ||
| top: 0.75rem; /* Approximate vertical center of h1 */ | ||
| right: 0; | ||
| z-index: 10; | ||
| } | ||
|
|
||
| /* Ensure h1 elements have enough right margin for the dropdown */ | ||
| .docItemContainer :global(h1:first-of-type) { | ||
| margin-right: 200px; | ||
| margin-bottom: 1.5rem; | ||
| } | ||
|
|
||
| /* Responsive design for mobile */ | ||
| @media (max-width: 768px) { | ||
| .docHeader { | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| } | ||
|
|
||
| .docTitle { | ||
| max-width: 100%; | ||
| margin-bottom: 1rem; | ||
| } | ||
|
|
||
| .docItemContainer :global(.copy-markdown-container) { | ||
| position: static; | ||
| margin-top: 1rem; | ||
| margin-bottom: 1rem; | ||
| } | ||
|
|
||
| .docItemContainer :global(h1:first-of-type) { | ||
| margin-right: 0; | ||
| margin-bottom: 1rem; | ||
| } | ||
| } | ||
|
|
||
| /* .container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .headerContainer { | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| margin-bottom: 1rem; | ||
| gap: 1rem; | ||
| max-width: 800px; | ||
| width: 100%; | ||
| } */ | ||
|
|
||
| /* .contentContainer { | ||
| width: 100%; | ||
| } | ||
|
|
||
| .contentContainer :global(h1:first-child) { | ||
| display: none; | ||
| } | ||
|
|
||
| @media (max-width: 768px) { | ||
| .headerContainer { | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| } | ||
| } */ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
^ hide right hand toc on the landing page so that the content can be expanded to the full page width