1
0
Fork 0
mirror of synced 2024-07-05 06:20:55 +12:00

Add button to reset styles

This commit is contained in:
Andrew Kingston 2021-01-05 11:48:14 +00:00
parent 19d71e318b
commit 57d69d1c9a
2 changed files with 9 additions and 4 deletions

View file

@ -32,6 +32,7 @@
const onStyleChanged = store.actions.components.updateStyle const onStyleChanged = store.actions.components.updateStyle
const onCustomStyleChanged = store.actions.components.updateCustomStyle const onCustomStyleChanged = store.actions.components.updateCustomStyle
const onResetStyles = store.actions.components.resetStyles
$: isComponentOrScreen = $: isComponentOrScreen =
$store.currentView === "component" || $store.currentView === "component" ||
@ -98,7 +99,8 @@
{panelDefinition} {panelDefinition}
{componentInstance} {componentInstance}
{onStyleChanged} {onStyleChanged}
{onCustomStyleChanged} /> {onCustomStyleChanged}
{onResetStyles} />
{:else if selectedCategory.value === 'settings'} {:else if selectedCategory.value === 'settings'}
<SettingsView <SettingsView
{componentInstance} {componentInstance}

View file

@ -1,5 +1,5 @@
<script> <script>
import { TextArea, DetailSummary } from "@budibase/bbui" import { TextArea, DetailSummary, Button } from "@budibase/bbui"
import PropertyGroup from "./PropertyGroup.svelte" import PropertyGroup from "./PropertyGroup.svelte"
import FlatButtonGroup from "./FlatButtonGroup.svelte" import FlatButtonGroup from "./FlatButtonGroup.svelte"
@ -8,6 +8,7 @@
export let componentDefinition = {} export let componentDefinition = {}
export let onStyleChanged = () => {} export let onStyleChanged = () => {}
export let onCustomStyleChanged = () => {} export let onCustomStyleChanged = () => {}
export let onResetStyles = () => {}
let selectedCategory = "normal" let selectedCategory = "normal"
let propGroup = null let propGroup = null
@ -46,16 +47,18 @@
on:open={() => (currentGroup = groupName)} /> on:open={() => (currentGroup = groupName)} />
{/each} {/each}
<DetailSummary <DetailSummary
name="Custom Styles" name={`Custom Styles${componentInstance._styles.custom ? ' *' : ''}`}
on:open={() => (currentGroup = 'custom')} on:open={() => (currentGroup = 'custom')}
show={currentGroup === 'custom'} show={currentGroup === 'custom'}
thin> thin>
<div class="custom-styles"> <div class="custom-styles">
<TextArea <TextArea
value={componentInstance._styles.custom} value={componentInstance._styles.custom}
on:change={event => onCustomStyleChanged(event.target.value)} /> on:change={event => onCustomStyleChanged(event.target.value)}
placeholder="Enter some CSS..." />
</div> </div>
</DetailSummary> </DetailSummary>
<Button secondary wide on:click={onResetStyles}>Reset Styles</Button>
{:else} {:else}
<div class="no-design"> <div class="no-design">
This component doesn't have any design properties. This component doesn't have any design properties.