diff --git a/widget/PR/App.jsx b/widget/PR/App.jsx index 23c0be9..679a9c0 100644 --- a/widget/PR/App.jsx +++ b/widget/PR/App.jsx @@ -32,61 +32,25 @@ if (!config) { } } -console.log("config", config); - if (!config) { return

unable to load config: {typeof config === object ? JSON.stringify(config) : config}

; } -const Layout = VM.require(config.layout?.src ?? "${alias_devs}/widget/Layout") || (() => <>); - -// While something like Theme should be in the parent... -const CSS = styled.div` - .container { - /* border: 1px solid red; */ - } - - .button { - } - - .input { - } - - .layout { - /* border: 4px solid var(--main-color); */ - } - - .header { - /* border: 1px solid blue; */ - } - - .content { - } - - .footer { - } -`; - -const Container = styled.div` - display: flex; - height: 100%; -`; - -const Content = styled.div` - width: 100%; - height: 100%; -`; - -// const Template = config.Template ?? (({children}) => <>{children}); +const Template = VM.require("${config_account}/widget/PR.Template"); return ( - - - - - - - - - + ); diff --git a/widget/PR/Template.jsx b/widget/PR/Template.jsx new file mode 100644 index 0000000..0116203 --- /dev/null +++ b/widget/PR/Template.jsx @@ -0,0 +1,27 @@ +const Container = styled.div` + display: flex; + height: 100%; +`; + +const Content = styled.div` + width: 100%; + height: 100%; +`; + +return ({ layout, theme, blocks, children }) => { + + const Layout = VM.require(layout?.src ?? "${alias_devs}/widget/Layout") || { + Layout: () => <>, + }; + + return ( + + + {children} + + + ); +}; \ No newline at end of file diff --git a/widget/document.jsx b/widget/document.jsx index 926c9b8..6730bad 100644 --- a/widget/document.jsx +++ b/widget/document.jsx @@ -2,20 +2,22 @@ const { basePath, param, _params } = props; let adapter = "${config_account}/widget/utils.adapter"; // this could come from props -const { MarkdownViewer } = VM.require("${alias_devs}/widget/markdown.view") || { - MarkdownViewer: () => null, -}; +const { MarkdownViewer } = VM.require("${alias_devs}/widget/markdown.view"); + +const Template = VM.require("${config_account}/widget/PR.Template"); const { get } = VM.require(adapter); const data = get(_params); -if (!data) { +if (!data) { // this could be a part of the template return

Page not found

; } return ( -
- -
+ ); diff --git a/widget/index.jsx b/widget/index.jsx index 9095a48..c35eca3 100644 --- a/widget/index.jsx +++ b/widget/index.jsx @@ -21,7 +21,7 @@ const config = { }, layout: { src: "${alias_devs}/widget/Layout", - props: { + initialProps: { variant: "sidebar", }, }, @@ -79,7 +79,7 @@ const config = { }, }; -const Root = styled.div` +const CSS = styled.div` * { box-sizing: border-box; font-weight: 400; @@ -221,10 +221,10 @@ const Root = styled.div` `; return ( - + - + );