From 38eacb5a10ef625cd65013e94b63b6549b7c92c0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 2 Nov 2021 08:47:19 +0000 Subject: [PATCH] Remove old files and tidy up --- .../components/{app/blocks => }/Block.svelte | 0 .../{app/blocks => }/BlockComponent.svelte | 0 .../components/app/blocks/block-builder.js | 14 ------ .../app/blocks/component-builder.js | 49 ------------------- 4 files changed, 63 deletions(-) rename packages/client/src/components/{app/blocks => }/Block.svelte (100%) rename packages/client/src/components/{app/blocks => }/BlockComponent.svelte (100%) delete mode 100644 packages/client/src/components/app/blocks/block-builder.js delete mode 100644 packages/client/src/components/app/blocks/component-builder.js diff --git a/packages/client/src/components/app/blocks/Block.svelte b/packages/client/src/components/Block.svelte similarity index 100% rename from packages/client/src/components/app/blocks/Block.svelte rename to packages/client/src/components/Block.svelte diff --git a/packages/client/src/components/app/blocks/BlockComponent.svelte b/packages/client/src/components/BlockComponent.svelte similarity index 100% rename from packages/client/src/components/app/blocks/BlockComponent.svelte rename to packages/client/src/components/BlockComponent.svelte diff --git a/packages/client/src/components/app/blocks/block-builder.js b/packages/client/src/components/app/blocks/block-builder.js deleted file mode 100644 index 2d56094806..0000000000 --- a/packages/client/src/components/app/blocks/block-builder.js +++ /dev/null @@ -1,14 +0,0 @@ -import { ComponentBuilder } from "./component-builder" - -export class BlockBuilder { - context - componentCount = 0 - - constructor(context) { - this.context = context - } - - createComponent(type, props) { - return new ComponentBuilder(this, type, props) - } -} diff --git a/packages/client/src/components/app/blocks/component-builder.js b/packages/client/src/components/app/blocks/component-builder.js deleted file mode 100644 index 90ce30c066..0000000000 --- a/packages/client/src/components/app/blocks/component-builder.js +++ /dev/null @@ -1,49 +0,0 @@ -export class ComponentBuilder { - context - - constructor(blockBuilder, type, props) { - this.blockBuilder = blockBuilder - this.type = type - this.id = `${blockBuilder.context.id}-${blockBuilder.componentCount++}` - this.props = props - this.children = [] - this.styles = null - } - - setProp(key, value) { - this.props[key] = value - return this - } - - setProps(props) { - this.props = { - ...this.props, - ...props, - } - return this - } - - setStyles(styles) { - this.styles = styles - return this - } - - addChild(component) { - this.children.push(component) - return this - } - - build() { - return { - _component: `@budibase/standard-components/${this.type}`, - _id: this.id, - _children: this.children?.map(child => child.build()), - _styles: { - normal: { - ...this.styles, - }, - }, - ...this.props, - } - } -}