File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed
Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ // Wrapper around Nextra Callout to add "example" type for user documentation
2+ import { Callout as NextraCallout } from 'nextra/components'
3+
4+ type CalloutProps = React . ComponentProps < typeof NextraCallout > & {
5+ type ?: 'default' | 'info' | 'warning' | 'error' | 'success' | 'example'
6+ }
7+
8+ export function Callout ( { type, children, ...props } : CalloutProps ) {
9+ if ( type === 'example' ) {
10+ return (
11+ < NextraCallout type = "info" { ...props } >
12+ < strong > Example:</ strong > { children }
13+ </ NextraCallout >
14+ )
15+ }
16+ return < NextraCallout type = { type as any } { ...props } > { children } </ NextraCallout >
17+ }
Original file line number Diff line number Diff line change 1+ // Module to help create terminal-like code blocks in user documentation.
2+ import React from "react" ;
3+
4+ // It'd be cool if we colored lines beginning with $ differently, but I wasn't
5+ // able to figure that out.
6+ export function Terminal ( { children } ) {
7+ return (
8+ < pre
9+ style = { {
10+ background : "#222" ,
11+ color : "#eee" ,
12+ padding : "1em" ,
13+ borderRadius : "6px" ,
14+ fontSize : "1em" ,
15+ overflowX : "auto" ,
16+ margin : "1em 0" ,
17+ // Not sure how to altogether avoid rendering links (example links in Terminal blocks are probably never
18+ // real links), but this makes them non-clickable
19+ pointerEvents : "none" ,
20+ } }
21+ >
22+ < code style = { { whiteSpace : "pre-wrap" } } > { children } </ code >
23+ </ pre >
24+ ) ;
25+ }
You can’t perform that action at this time.
0 commit comments