Skip to content

Commit

Permalink
refactor: remove unused demo code
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Sep 27, 2023
1 parent 550bd0e commit e4cab76
Show file tree
Hide file tree
Showing 50 changed files with 16 additions and 2,366 deletions.
2 changes: 0 additions & 2 deletions apps/demo/app/Framework.ts

This file was deleted.

22 changes: 5 additions & 17 deletions apps/demo/app/[...puckPath]/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,20 @@
import { Config, Data } from "@measured/puck";
import { Puck } from "@measured/puck/components/Puck";
import { Render } from "@measured/puck/components/Render";
import { Framework } from "../Framework";
import { useEffect, useState } from "react";
import { Button } from "@measured/puck/components/Button";
import headingAnalyzer from "@measured/puck-plugin-heading-analyzer/src/HeadingAnalyzer";
import config, { initialData } from "../../config";

const isBrowser = typeof window !== "undefined";

export function Client({
path,
isEdit,
framework,
}: {
path: string;
isEdit: boolean;
framework: Framework;
}) {
const config: Config = require(`../configs/${framework}/`).default;
const initialData: Data =
require(`../configs/${framework}/`).initialData || {};

export function Client({ path, isEdit }: { path: string; isEdit: boolean }) {
// unique b64 key that updates each time we add / remove components
const componentKey = Buffer.from(
Object.keys(config.components).join("-")
).toString("base64");

const key = `puck-demo:${framework}:${componentKey}:${path}`;
const key = `puck-demo:${componentKey}:${path}`;

const [data] = useState<Data>(() => {
if (isBrowser) {
Expand All @@ -52,7 +40,7 @@ export function Client({
return (
<div>
<Puck
config={config}
config={config as Config}
data={data}
onPublish={async (data: Data) => {
localStorage.setItem(key, JSON.stringify(data));
Expand All @@ -72,7 +60,7 @@ export function Client({
}

if (data) {
return <Render config={config} data={data} />;
return <Render config={config as Config} data={data} />;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/app/[...puckPath]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ export default async function Page({
}) {
const { isEdit, path } = resolvePuckPath(params.puckPath);

return <Client isEdit={isEdit} path={path} framework={"custom"} />;
return <Client isEdit={isEdit} path={path} />;
}
52 changes: 0 additions & 52 deletions apps/demo/app/configs/antd/blocks/CardDeck.tsx

This file was deleted.

53 changes: 0 additions & 53 deletions apps/demo/app/configs/antd/blocks/Carousel.tsx

This file was deleted.

94 changes: 0 additions & 94 deletions apps/demo/app/configs/antd/blocks/Hero.tsx

This file was deleted.

54 changes: 0 additions & 54 deletions apps/demo/app/configs/antd/blocks/Video.tsx

This file was deleted.

Loading

0 comments on commit e4cab76

Please sign in to comment.