-
-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathplugin.tsx
More file actions
31 lines (29 loc) · 773 Bytes
/
plugin.tsx
File metadata and controls
31 lines (29 loc) · 773 Bytes
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
/** @jsxImportSource solid-js - we use Solid.js as JSX here */
import type { JSX } from 'solid-js'
import type { DevtoolsPanelProps } from './panel'
import type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'
export function createSolidPlugin({
Component,
...config
}: {
name: string
id?: string
defaultOpen?: boolean
Component: (props: DevtoolsPanelProps) => JSX.Element
}) {
function Plugin() {
return {
...config,
render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => {
return <Component {...props} />
},
}
}
function NoOpPlugin() {
return {
...config,
render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => <></>,
}
}
return [Plugin, NoOpPlugin] as const
}