Browse Source

Merge branch 'master' of github.com:Budibase/budibase into feature/handlebars-migration

pull/1008/head
mike12345567 6 years ago
parent
commit
6a40ea7f06
  1. 6
      packages/client/src/components/Component.svelte
  2. 16
      packages/standard-components/src/Icon.svelte
  3. 28
      packages/standard-components/src/List.svelte

6
packages/client/src/components/Component.svelte

@ -32,7 +32,11 @@
$builderStore.previewType === "layout" || screenslotContext $builderStore.previewType === "layout" || screenslotContext
// Update component context // Update component context
$: componentStore.set({ id, styles: { ...styles, id, allowSelection } }) $: componentStore.set({
id,
children: children.length,
styles: { ...styles, id, allowSelection },
})
// Gets the component constructor for the specified component // Gets the component constructor for the specified component
const getComponentConstructor = component => { const getComponentConstructor = component => {

16
packages/standard-components/src/Icon.svelte

@ -1,13 +1,19 @@
<script> <script>
import { getContext } from "svelte" import { getContext } from "svelte"
// Add this back once we can define specific design options to expose const { styleable } = getContext("sdk")
// const { styleable } = getContext("sdk") const component = getContext("component")
// const component = getContext("component")
export let icon = "" export let icon = ""
export let size = "fa-lg" export let size = "fa-lg"
export let color = "#000" export let color = "#f00"
$: styles = {
...$component.styles,
normal: {
...$component.styles.normal,
color,
},
}
</script> </script>
<i style={`color: ${color};`} class={`${icon} ${size}`} /> <i use:styleable={styles} class="{icon} {size}" />

28
packages/standard-components/src/List.svelte

@ -24,9 +24,27 @@
</script> </script>
<div use:styleable={$component.styles}> <div use:styleable={$component.styles}>
{#each rows as row} {#if rows.length > 0}
<DataProvider {row}> {#each rows as row}
<slot /> <DataProvider {row}>
</DataProvider> {#if $component.children === 0}
{/each} <p>Add some components too.</p>
{:else}
<slot />
{/if}
</DataProvider>
{/each}
{:else}
<p>Feed me some data</p>
{/if}
</div> </div>
<style>
p {
display: grid;
place-items: center;
background: #f5f5f5;
border: #ccc 1px solid;
padding: var(--spacing-m);
}
</style>

Loading…
Cancel
Save