Skip to content

Commit

Permalink
update layout
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Apr 15, 2024
1 parent 124420b commit 29f4f2d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
app-name: "devs.near"
deploy-account-address: devs.near
signer-account-address: devs.near
signer-public-key: ed25519:GQ5BKDUmHhVK8uyviD3pnzmHAAXSKhhzVsjb2effMMwo
signer-public-key: ed25519:J8XTprxQ1nAmCPwtYWHLBCUWq4mwn8zkE2aHwJTtFo1Y
secrets:
SIGNER_PRIVATE_KEY: ${{ secrets.SIGNER_PRIVATE_KEY }}
SIGNER_PRIVATE_KEY: ${{ secrets.DEVS_SIGNER_PRIVATE_KEY }}
106 changes: 54 additions & 52 deletions widget/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,62 +29,64 @@ const SplitLayout = styled.div`
}
`;

return ({ variant, blocks, children }) => {
const { Header, Footer, Sidebar, Left, Right } = blocks;
return {
Layout: ({ variant, blocks, children }) => {
const { Header, Footer, Sidebar, Left, Right } = blocks;

Header = Header ? Header : () => <></>;
Footer = Footer ? Footer : () => <></>;
Sidebar = Sidebar ? Sidebar : () => <></>;
Left = Left ? Left : ({ children }) => <>{children}</>;
Right = Right ? Right : ({ children }) => <>{children}</>;
Header = Header ? Header : () => <></>;
Footer = Footer ? Footer : () => <></>;
Sidebar = Sidebar ? Sidebar : () => <></>;
Left = Left ? Left : ({ children }) => <>{children}</>;
Right = Right ? Right : ({ children }) => <>{children}</>;

if (!variant) {
variant = "standard";
}
if (!variant) {
variant = "standard";
}

const availableVariants = ["standard", "sidebar", "split"];
const availableVariants = ["standard", "sidebar", "split"];

if (!availableVariants.includes(variant)) {
return 'Invalid Variant: "' + variant + '"';
}
if (!availableVariants.includes(variant)) {
return 'Invalid Variant: "' + variant + '"';
}

switch (variant) {
case "standard":
return (
<StandardLayout>
<Header />
{children}
<Footer />
</StandardLayout>
);
case "sidebar":
return (
<StandardLayout>
<Header />
<SidebarLayout>
<div className="aside">
switch (variant) {
case "standard":
return (
<StandardLayout>
<Header />
{children}
<Footer />
</StandardLayout>
);
case "sidebar":
return (
<StandardLayout>
<Header />
<SidebarLayout>
<div className="aside">
<Sidebar />
</div>
<div className="main">{children}</div>
</SidebarLayout>
<Footer />
</StandardLayout>
);
case "split":
return (
<StandardLayout>
<Header />
<SplitLayout>
<Sidebar />
</div>
<div className="main">{children}</div>
</SidebarLayout>
<Footer />
</StandardLayout>
);
case "split":
return (
<StandardLayout>
<Header />
<SplitLayout>
<Sidebar />
<div className="children">
<Left>{children}</Left>
</div>
<div className="children">
<Right>{children}</Right>
</div>
</SplitLayout>
<Footer />
</StandardLayout>
);
}
<div className="children">
<Left>{children}</Left>
</div>
<div className="children">
<Right>{children}</Right>
</div>
</SplitLayout>
<Footer />
</StandardLayout>
);
}
},
};

0 comments on commit 29f4f2d

Please sign in to comment.