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.
import components from "./temporaryPanelStructure.js"
import Tab from "./ComponentTab/Tab.svelte"
import { store } from "builderStore"
const categories = components.categories
let selectedCategory = categories[0]

View File

@ -1,13 +1,24 @@
<script>
import Item from "./Item.svelte"
import { store } from "builderStore"
export let list
let category = list
const onComponentChosen = component => {
// if (component.template) {
// onTemplateChosen(component.template)
// } else {
store.addChildComponent(component._component)
// toggleTab()
// }
}
const handleClick = component => {
if (component.type && component.type.length > 0) {
list = component
} 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>
.back-button {
font-size: 16px;
width: 100%;
text-align: center;
height: 40px;

View File

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