diff --git a/packages/builder/src/components/userInterface/ComponentSelectionList.svelte b/packages/builder/src/components/userInterface/ComponentSelectionList.svelte index d769321de1..a47ea813b0 100644 --- a/packages/builder/src/components/userInterface/ComponentSelectionList.svelte +++ b/packages/builder/src/components/userInterface/ComponentSelectionList.svelte @@ -72,13 +72,16 @@ $: templatesByComponent = groupBy(t => t.component)($store.templates) $: hierarchy = $store.hierarchy $: libraryModules = $store.libraries - $: standaloneTemplates = pipe(templatesByComponent, [ - values, - flatten, - filter(t => !$store.components.some(c => c.name === t.component)), - map(t => ({ name: splitName(t.component).componentName, template: t })), - uniqBy(t => t.name), - ]) + $: standaloneTemplates = pipe( + templatesByComponent, + [ + values, + flatten, + filter(t => !$store.components.some(c => c.name === t.component)), + map(t => ({ name: splitName(t.component).componentName, template: t })), + uniqBy(t => t.name), + ] + )
@@ -92,9 +95,14 @@ {/each}
+ onComponentChosen(e.detail)} /> + on:selectItem={e => onComponentChosen(e.detail)} + {onTemplateChosen} + {toggleTab} />
diff --git a/packages/builder/src/components/userInterface/ItemTab/Tab.svelte b/packages/builder/src/components/userInterface/ItemTab/Tab.svelte index ee92c084a5..0b9ef7eeb7 100644 --- a/packages/builder/src/components/userInterface/ItemTab/Tab.svelte +++ b/packages/builder/src/components/userInterface/ItemTab/Tab.svelte @@ -5,6 +5,10 @@ import Item from "./Item.svelte" import { store } from "builderStore" export let list + + export let toggleTab + export let onTemplateChosen + let category = list const handleClick = item => { diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index 99c37e5ffb..0f067abade 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -5,6 +5,7 @@ export default { isCategory: true, children: [ { + _component: "@budibase/standard-components/container", name: 'Container', description: 'This component contains things within itself', icon: 'ri-layout-row-fill', @@ -23,14 +24,12 @@ export default { icon: 'headline', props: { type: { - type: 'options', - options: [ - 'h1', - 'h2' - ], - 'default': 'h1' - } - } + type: "options", + options: ["h1", "h2", "h3", "h4", "h5", "h6"], + default: "h1", + }, + text: "string", + }, }, { _component: '@budibase/standard-components/text', @@ -41,40 +40,7 @@ export default { ] }, { - name: 'Button', - description: 'A basic html button that is ready for styling', - icon: 'ri-radio-button-fill', - commonProps: {}, - children: [] - }, - { - name: 'Icon', - description: 'A basic component for displaying icons', - icon: 'ri-sun-fill', - commonProps: {}, - children: [] - }, - { - name: 'Avatar', - description: 'A basic component for rendering an avatar', - icon: 'ri-user-smile-fill', - commonProps: {}, - children: [] - }, - { - name: 'Link', - description: 'A basic link component for internal and external links', - icon: 'ri-link', - commonProps: {}, - children: [] - } - ] - }, - { - name: 'Form', - isCategory: true, - children: [ - { + _component: "@budibase/standard-components/button", name: 'Button', description: 'A basic html button that is ready for styling', icon: 'ri-radio-button-fill', @@ -109,6 +75,7 @@ export default { isCategory: true, children: [ { + _component: "@budibase/materialdesign-components/BasicCard", name: 'Card', description: 'A basic card component that can contain content and actions.', icon: 'ri-layout-bottom-line', diff --git a/packages/materialdesign-components/components.json b/packages/materialdesign-components/components.json index f2a6db42a6..f0750e6446 100644 --- a/packages/materialdesign-components/components.json +++ b/packages/materialdesign-components/components.json @@ -115,6 +115,21 @@ }, "tags": [] }, + "BasicCard": { + "name": "BasicCard", + "description": "This is a basic card", + "props": { + "heading": "string", + "subheading": "string", + "content": "string", + "imageUrl": "string", + "button1Text": "string", + "button2Text": "string", + "cardClick": "event", + "button1Click": "event", + "button2Click": "event" + } + }, "Card": { "name": "Card", "description": "A Material Card container. Accepts CardHeader, CardBody and CardFooter as possible children", diff --git a/packages/materialdesign-components/src/Card/BasicCard.svelte b/packages/materialdesign-components/src/Card/BasicCard.svelte new file mode 100644 index 0000000000..cb377b7737 --- /dev/null +++ b/packages/materialdesign-components/src/Card/BasicCard.svelte @@ -0,0 +1,67 @@ + + +
+
+ {#if showImage} +
+ {/if} +
+
+

+ {heading} +

+

+ {subheading} +

+
+
+ {content} +
+ +
+
+ {#if showButtons} +
+
+ {#if showButton1} + + {/if} + {#if showButton2} + + {/if} +
+
+ {/if} +
+ + diff --git a/packages/materialdesign-components/src/Card/index.js b/packages/materialdesign-components/src/Card/index.js index ff089d6797..cc918b935f 100644 --- a/packages/materialdesign-components/src/Card/index.js +++ b/packages/materialdesign-components/src/Card/index.js @@ -1,5 +1,6 @@ import "./_styles.scss" export { default as Card } from "./Card.svelte" +export { default as BasicCard } from "./BasicCard.svelte" export { default as CardBody } from "./CardBody.svelte" export { default as CardFooter } from "./CardFooter.svelte" export { default as CardHeader } from "./CardHeader.svelte" diff --git a/packages/materialdesign-components/src/index.js b/packages/materialdesign-components/src/index.js index aa6632c48c..6f234a217d 100644 --- a/packages/materialdesign-components/src/index.js +++ b/packages/materialdesign-components/src/index.js @@ -22,7 +22,7 @@ export { Menu } from "./Menu" export { Select } from "./Select" export { DatePicker } from "./DatePicker" export { IconButton } from "./IconButton" -export { Card, CardHeader, CardImage, CardBody, CardFooter } from "./Card" +export { Card, CardHeader, CardImage, CardBody, CardFooter, BasicCard } from "./Card" export { Dialog, DialogHeader, DialogContent, DialogActions } from "./Dialog" export { Switch } from "./Switch" export { Slider } from "./Slider" diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json index 706aee95ec..f69041fc0f 100644 --- a/packages/standard-components/components.json +++ b/packages/standard-components/components.json @@ -214,6 +214,7 @@ "description": "An HTML H1 - H6 tag", "props" : { "className":"string", + "text": "string", "type": { "type": "options", "default": "h1", diff --git a/packages/standard-components/src/Heading.svelte b/packages/standard-components/src/Heading.svelte index 859784eb99..e3919b7f64 100644 --- a/packages/standard-components/src/Heading.svelte +++ b/packages/standard-components/src/Heading.svelte @@ -2,22 +2,22 @@ export let className = "" export let type export let _bb - + export let text = "" let containerElement - $: containerElement && _bb.attachChildren(containerElement) + $: containerElement && !text && _bb.attachChildren(containerElement) {#if type === 'h1'} -

+

{text}

{:else if type === 'h2'} -

+

{text}

{:else if type === 'h3'} -

+

{text}

{:else if type === 'h4'} -

+

{text}

{:else if type === 'h5'} -
+
{text}
{:else if type === 'h6'} -
+
{text}
{/if}