-
Notifications
You must be signed in to change notification settings - Fork 27
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
Changes from all commits
fd35d53
b801dd5
28eac45
ee1baca
9f57411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
slug: / | ||
pagination_next: null | ||
hide_table_of_contents: true | ||
--- | ||
|
||
# Home | ||
|
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.
This file was deleted.
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> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.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; | ||
} | ||
} |
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. we're now swizzling DocItem/Content instead of Layout |
This file was deleted.
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