Browse Source

Adding onComponentChosen fn for new components

gh-pages
Conor_Mack 7 years ago
parent
commit
09c7dd6867
  1. 1
      packages/builder/src/components/userInterface/ComponentSelectionList.svelte
  2. 14
      packages/builder/src/components/userInterface/ComponentTab/Tab.svelte
  3. 4
      packages/builder/src/components/userInterface/temporaryPanelStructure.js

1
packages/builder/src/components/userInterface/ComponentSelectionList.svelte

@ -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]

14
packages/builder/src/components/userInterface/ComponentTab/Tab.svelte

@ -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;

4
packages/builder/src/components/userInterface/temporaryPanelStructure.js

@ -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: []
} }
] ]

Loading…
Cancel
Save