-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathmdx-components.jsx
More file actions
74 lines (63 loc) · 1.91 KB
/
mdx-components.jsx
File metadata and controls
74 lines (63 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { useMDXComponents as getThemeComponents } from 'nextra-theme-docs'
import { Btn } from './components/mdx/Btn'
import { InfoBox, WarningBox, SuccessBox, ReferenceBox } from './components/mdx/AlertBox'
import { Screenshot, Diagram } from './components/mdx/Screenshot'
import { YouTubeVideo } from './components/mdx/YouTubeVideo'
import { LoomVideo } from './components/mdx/LoomVideo'
import { ProductVideo } from './components/mdx/ProductVideo'
import { CommunitySupportedDriver } from './components/mdx/CommunitySupportedDriver'
import { Grid } from './components/mdx/Grid'
import { GridItem } from './components/mdx/GridItem'
import { CodeTabs } from './components/mdx/CodeTabs'
import { Pre } from './components/mdx/Pre'
import { EnvVar } from './components/mdx/EnvVar'
import { FeedbackBlock } from './components/FeedbackBlock'
const themeComponents = getThemeComponents()
// Custom wrapper that adds FeedbackBlock at the bottom of each page
const ThemeWrapper = themeComponents.wrapper
const CustomWrapper = ({ children, ...props }) => (
<ThemeWrapper {...props}>
{children}
<FeedbackBlock />
</ThemeWrapper>
)
// Stub component that renders children
const Stub = ({ children }) => <>{children}</>
// Stub component that renders nothing
const EmptyStub = () => null
// Stub components - to be replaced with real implementations
const customComponents = {
// UI Components
Btn,
Screenshot,
Diagram,
// Code display
CodeTabs,
pre: Pre,
// Alert boxes
InfoBox,
WarningBox,
SuccessBox,
ReferenceBox,
// Layout
Grid,
GridItem,
// Video embeds
YouTubeVideo,
LoomVideo,
ProductVideo,
// Cube-specific components
CommunitySupportedDriver,
EnvVar,
QueryBuilder: EmptyStub,
QueryRenderer: EmptyStub,
CubeProvider: Stub,
}
export function useMDXComponents(components) {
return {
...themeComponents,
...customComponents,
wrapper: CustomWrapper,
...components
}
}