1
0
Fork 0
mirror of synced 2024-10-05 04:25:21 +13:00

Adding onComponentChosen fn for new components

This commit is contained in:
Conor_Mack 2020-04-20 15:10:23 +01:00
parent cb6f86494d
commit f58e4c5410
3 changed files with 16 additions and 3 deletions

View file

@ -2,6 +2,7 @@
// This should be fetched from somewhere in the future, rather than be hardcoded. // This should be fetched from somewhere in the future, rather than be hardcoded.
import components from "./temporaryPanelStructure.js" import components from "./temporaryPanelStructure.js"
import Tab from "./ComponentTab/Tab.svelte" import Tab from "./ComponentTab/Tab.svelte"
import { store } from "builderStore"
const categories = components.categories const categories = components.categories
let selectedCategory = categories[0] let selectedCategory = categories[0]

View file

@ -1,13 +1,24 @@
<script> <script>
import Item from "./Item.svelte" import Item from "./Item.svelte"
import { store } from "builderStore"
export let list export let list
let category = list let category = list
const onComponentChosen = component => {
// if (component.template) {
// onTemplateChosen(component.template)
// } else {
store.addChildComponent(component._component)
// toggleTab()
// }
}
const handleClick = component => { const handleClick = component => {
if (component.type && component.type.length > 0) { if (component.type && component.type.length > 0) {
list = component list = component
} else { } else {
console.log("Here be dragons that add the component! 🐉") //console.log("Here be dragons that add the component! 🐉")
onComponentChosen(component)
} }
} }
@ -27,7 +38,6 @@
<style> <style>
.back-button { .back-button {
font-size: 16px; font-size: 16px;
width: 100%; width: 100%;
text-align: center; text-align: center;
height: 40px; height: 40px;

View file

@ -18,7 +18,7 @@ export default {
commonProps: {}, commonProps: {},
type: [ type: [
{ {
_component: '@budibase/standard-components/header', _component: '@budibase/standard-components/heading',
name: 'Headline', name: 'Headline',
icon: 'headline', icon: 'headline',
props: { props: {
@ -140,6 +140,7 @@ export default {
description: 'A component that generates a table from your data.', description: 'A component that generates a table from your data.',
icon: 'ri-archive-drawer-fill', icon: 'ri-archive-drawer-fill',
commonProps: {}, commonProps: {},
modelRequired: true,
type: [] type: []
}, },
{ {
@ -147,6 +148,7 @@ export default {
description: 'A component that generates a form from your data.', description: 'A component that generates a form from your data.',
icon: 'ri-file-edit-fill', icon: 'ri-file-edit-fill',
commonProps: {}, commonProps: {},
modelRequired: true,
type: [] type: []
} }
] ]