-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplasmic-host.tsx
60 lines (55 loc) · 1.63 KB
/
plasmic-host.tsx
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
import * as React from 'react';
import {PlasmicCanvasHost, registerComponent, registerGlobalContext} from '@plasmicapp/react-web/lib/host';
import {AppContextProvider} from "@/src/AppContextProvider";
import {Calendar} from "@/src/Calendar";
export default function PlasmicHost() {
return <PlasmicCanvasHost />;
}
// You can register any code components that you want to use here; see
// https://docs.plasmic.app/learn/code-components-ref/
// And configure your Plasmic project to use the host url pointing at
// the /plasmic-host page of your nextjs app (for example,
// http://localhost:3000/plasmic-host). See
// https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
// registerComponent(...)
registerGlobalContext(AppContextProvider, {
name: "AppContextProvider",
props: {
directusUrl: "string",
initialCurrentUser: "object",
},
providesData: true,
globalActions: {
login: { parameters: [{ name: "credential", type: "string" }] },
logout: { parameters: [] },
updateUser: { parameters: [{ name: "id", type: "string" }, { name: "data", type: "object" }]},
},
importPath: "./src/AppContextProvider",
});
registerComponent(Calendar,{
name: "Calendar",
props: {
value: {
type: "dateString",
defaultValue: "2024-01-01",
},
onChange: {
type: "eventHandler",
argTypes: [
{
name: "event",
type: "object",
},
],
},
},
states: {
value: {
type: "writable",
variableType: "dateString",
onChangeProp: "onChange",
valueProp: "value",
},
},
importPath: "./src/Calendar",
});