-
Notifications
You must be signed in to change notification settings - Fork 7
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
Migrate to new AsciiDoc renderer #95
Merged
+1,629
−2,544
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a77a7ef
Initial conversion
benjaminleonard 37b1f2c
ToC tweaks
benjaminleonard 7492e4a
Merge branch 'main' into new-prepare-document
benjaminleonard 44ac341
Design system tweaks
benjaminleonard 714601d
Fix node version
benjaminleonard 2a30065
Add missing license files
benjaminleonard 5030e4d
Fmt
benjaminleonard ad6c48d
Lint
benjaminleonard 229a3d8
Cleanup and mobile ToC scroll fix
benjaminleonard c231c0d
Tweak tokens
benjaminleonard f31b77d
Upgrade ds for code text size tweak
benjaminleonard fd5239c
Narrow scope of search element get with playwright
benjaminleonard 68f10b9
Exact playwright el match fix
benjaminleonard 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 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 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,64 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, you can obtain one at https://mozilla.org/MPL/2.0/. | ||
* | ||
* Copyright Oxide Computer Company | ||
*/ | ||
import { type DocumentBlock } from '@oxide/react-asciidoc' | ||
benjaminleonard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import { Link } from '@remix-run/react' | ||
|
||
import Container from '../Container' | ||
import { GotoIcon } from '../CustomIcons' | ||
|
||
const Footnotes = ({ doc }: { doc: DocumentBlock }) => { | ||
if (!doc.footnotes) return null | ||
|
||
if (doc.footnotes.length > 0 && doc.blocks && !doc.attributes['nofootnotes']) { | ||
return ( | ||
<div id="footnotes" className="mt-12 border-t pt-4 border-secondary 800:mt-16"> | ||
<Container isGrid> | ||
<div className="col-span-12 col-start-2 text-mono-xs text-tertiary 1200:col-span-2 1200:col-start-1"> | ||
Footnotes | ||
</div> | ||
|
||
<ul | ||
id="footnotes" | ||
className="col-span-12 col-start-2 800:pr-16 1200:col-start-3 1200:w-[calc(100%-var(--toc-width))] print:!col-span-12 print:!col-start-1" | ||
> | ||
{doc.footnotes.map((footnote) => ( | ||
<li | ||
key={footnote.index} | ||
id={`_footnotedef_${footnote.index}`} | ||
className="relative mb-2" | ||
> | ||
<div className="absolute -left-12 -top-[2px] flex flex-shrink-0 items-center justify-center rounded-full px-[4px] py-[2px] !tracking-normal text-mono-xs text-default bg-tertiary"> | ||
{footnote.index} | ||
</div> | ||
<div className="text-sans-md text-default"> | ||
<p | ||
dangerouslySetInnerHTML={{ __html: footnote.text || '' }} | ||
className="inline" | ||
/>{' '} | ||
<Link | ||
className="footnote group -m-2 whitespace-nowrap p-2 text-accent-tertiary group-hover:text-accent" | ||
to={`#_footnoteref_${footnote.index}`} | ||
> | ||
<GotoIcon className="inline-block rotate-180" /> | ||
<span className="inline-block translate-x-0 opacity-0 transition-all group-hover:translate-x-1 group-hover:opacity-100"> | ||
View | ||
</span> | ||
</Link> | ||
</div> | ||
</li> | ||
))} | ||
</ul> | ||
</Container> | ||
</div> | ||
) | ||
} else { | ||
return null | ||
} | ||
} | ||
|
||
export default Footnotes |
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.
Nice to move most of this out into shared code in
@oxide/design-system
– since we use the ToC on the docs site also.