Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unused demo code #116

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading