style abstraction

This commit is contained in:
Martin McKeaveney 2020-02-24 15:00:48 +00:00
parent bd225d1eac
commit 5793413126
28 changed files with 260 additions and 267 deletions

View File

@ -5,6 +5,7 @@
import { store, initialise } from "./builderStore" import { store, initialise } from "./builderStore"
import { onMount } from "svelte" import { onMount } from "svelte"
import IconButton from "./common/IconButton.svelte" import IconButton from "./common/IconButton.svelte"
import Spinner from "./common/Spinner.svelte"
let init = initialise() let init = initialise()
</script> </script>
@ -12,9 +13,9 @@
<main> <main>
{#await init} {#await init}
<div class="spinner-container">
<h1>loading</h1> <Spinner />
</div>
{:then result} {:then result}
{#if $store.hasAppPackage} {#if $store.hasAppPackage}
@ -52,4 +53,13 @@
bottom: 25px; bottom: 25px;
right: 25px; right: 25px;
} }
.spinner-container {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style> </style>

View File

@ -4,6 +4,7 @@
import Checkbox from "../common/Checkbox.svelte" import Checkbox from "../common/Checkbox.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "../common/ButtonGroup.svelte"
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte"
import { validateAccessLevels } from "../common/core" import { validateAccessLevels } from "../common/core"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "../common/ErrorsBox.svelte"
@ -64,7 +65,7 @@
<form class="uk-form-horizontal"> <form class="uk-form-horizontal">
<Textbox label="Name" bind:text={clonedLevel.name} /> <Textbox label="Access Level Name" bind:text={clonedLevel.name} />
{#each permissionMatrix as permission} {#each permissionMatrix as permission}
<div> <div>
@ -78,10 +79,10 @@
</form> </form>
<ButtonGroup style="margin-top: 10px"> <ButtonGroup style="margin-top: 10px">
<Button color="primary" grouped on:click={save}>Save</Button> <ActionButton primary grouped on:click={save}>Save</ActionButton>
<Button color="secondary" grouped on:click={() => onFinished()}> <ActionButton alert grouped on:click={() => onFinished()}>
Cancel Cancel
</Button> </ActionButton>
</ButtonGroup> </ButtonGroup>
</div> </div>

View File

@ -1,6 +1,7 @@
<script> <script>
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "../common/ButtonGroup.svelte"
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte"
import { store } from "../builderStore" import { store } from "../builderStore"
import { generateFullPermissions, getNewAccessLevel } from "../common/core" import { generateFullPermissions, getNewAccessLevel } from "../common/core"
import getIcon from "../common/icon" import getIcon from "../common/icon"
@ -47,11 +48,10 @@
</script> </script>
<div class="root"> <div class="root">
<ButtonGroup> <ButtonGroup>
<Button grouped color="secondary" on:click={createNewLevel}> <ActionButton primary on:click={createNewLevel}>
Create New Access Level Create New Access Level
</Button> </ActionButton>
</ButtonGroup> </ButtonGroup>
{#if $store.accessLevels} {#if $store.accessLevels}

View File

@ -1,6 +1,7 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "../common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "../common/ButtonGroup.svelte"
import { cloneDeep, filter, keys, map, isUndefined } from "lodash/fp" import { cloneDeep, filter, keys, map, isUndefined } from "lodash/fp"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "../common/ErrorsBox.svelte"
@ -10,16 +11,15 @@
export let action export let action
export let onFinished = action => {} export let onFinished = action => {}
export let allActions export let allActions
export let isNew = true
let optKey = "" let optKey = ""
let optValue = "" let optValue = ""
let clonedAction = cloneDeep(action) let clonedAction = cloneDeep(action)
let initialOptions = pipe(action.initialOptions, [ let initialOptions = pipe(
keys, action.initialOptions,
map(k => ({ key: k, value: action.initialOptions[k] })), [keys, map(k => ({ key: k, value: action.initialOptions[k] }))]
]) )
let errors = [] let errors = []
const addNewOption = () => { const addNewOption = () => {
@ -44,17 +44,26 @@
const removeOption = opt => { const removeOption = opt => {
if (opt) { if (opt) {
delete clonedAction.initialOptions[opt.key] delete clonedAction.initialOptions[opt.key]
initialOptions = pipe(initialOptions, [filter(o => o.key !== opt.key)]) initialOptions = pipe(
initialOptions,
[filter(o => o.key !== opt.key)]
)
} }
} }
const save = () => { const save = () => {
const newActionsList = [ const newActionsList = [
...pipe(allActions, [filter(a => a !== action)]), ...pipe(
allActions,
[filter(a => a !== action)]
),
clonedAction, clonedAction,
] ]
errors = pipe(newActionsList, [validateActions, map(e => e.error)]) errors = pipe(
newActionsList,
[validateActions, map(e => e.error)]
)
if (errors.length === 0) onFinished(clonedAction) if (errors.length === 0) onFinished(clonedAction)
} }
@ -89,9 +98,7 @@
class="uk-input uk-width-1-4 uk-margin-right" class="uk-input uk-width-1-4 uk-margin-right"
placeholder="value" placeholder="value"
bind:value={optValue} /> bind:value={optValue} />
<Button color="primary-outline uk-width-1-4" on:click={addNewOption}> <ActionButton primary on:click={addNewOption}>Add</ActionButton>
Add
</Button>
</div> </div>
<div style="margin-top: 10px"> <div style="margin-top: 10px">
{#each initialOptions as option} {#each initialOptions as option}
@ -107,11 +114,12 @@
</div> </div>
</div> </div>
<ButtonGroup> <div class="uk-modal-footer uk-text-right">
<Button color="secondary" grouped on:click={save}>Save</Button> <ButtonGroup>
<Button color="tertiary" grouped on:click={cancel}>Cancel</Button> <ActionButton primary grouped on:click={save}>Save</ActionButton>
</ButtonGroup> <ActionButton alert grouped on:click={cancel}>Cancel</ActionButton>
</ButtonGroup>
</div>
</div> </div>
<style> <style>

View File

@ -43,7 +43,7 @@
} }
</script> </script>
<h3 class="title">Actions</h3> <h3 class="budibase__title--3">Actions</h3>
{#if actionsArray} {#if actionsArray}
<table class="fields-table uk-table uk-table-small uk-table-striped"> <table class="fields-table uk-table uk-table-small uk-table-striped">
@ -99,11 +99,6 @@
color: var(--secondary75); color: var(--secondary75);
} }
.title {
margin: 3rem 0rem 0rem 0rem;
font-weight: 700;
}
.table-content { .table-content {
font-weight: 500; font-weight: 500;
font-size: 0.9rem; font-size: 0.9rem;

View File

@ -2,6 +2,7 @@
import getIcon from "../common/icon" import getIcon from "../common/icon"
import { store } from "../builderStore" import { store } from "../builderStore"
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "../common/ButtonGroup.svelte"
import Actions from "./Actions.svelte" import Actions from "./Actions.svelte"
import Triggers from "./Triggers.svelte" import Triggers from "./Triggers.svelte"
@ -83,12 +84,12 @@
<div class="root"> <div class="root">
<div class="actions-header"> <div class="actions-header">
<ButtonGroup> <ButtonGroup>
<Button color="secondary" grouped on:click={newAction}> <ActionButton color="secondary" grouped on:click={newAction}>
Create New Action Create New Action
</Button> </ActionButton>
<Button color="tertiary" grouped on:click={newTrigger}> <ActionButton color="tertiary" grouped on:click={newTrigger}>
Create New Trigger Create New Trigger
</Button> </ActionButton>
</ButtonGroup> </ButtonGroup>
</div> </div>
@ -121,6 +122,7 @@
.actions-header { .actions-header {
flex: 0 1 auto; flex: 0 1 auto;
margin-bottom: 10px;
} }
.node-view { .node-view {

View File

@ -1,6 +1,7 @@
<script> <script>
import Textbox from "../common/Textbox.svelte" import Textbox from "../common/Textbox.svelte"
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte"
import Dropdown from "../common/Dropdown.svelte" import Dropdown from "../common/Dropdown.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "../common/ButtonGroup.svelte"
import CodeArea from "../common/CodeArea.svelte" import CodeArea from "../common/CodeArea.svelte"
@ -22,7 +23,10 @@
let cancel = () => onFinished() let cancel = () => onFinished()
let save = () => { let save = () => {
const newTriggersList = [ const newTriggersList = [
...pipe(allTriggers, [filter(t => t !== trigger)]), ...pipe(
allTriggers,
[filter(t => t !== trigger)]
),
clonedTrigger, clonedTrigger,
] ]
@ -59,11 +63,12 @@
</form> </form>
<ButtonGroup> <div class="uk-modal-footer uk-text-right">
<Button color="primary" grouped on:click={save}>Save</Button> <ButtonGroup>
<Button color="tertiary" grouped on:click={cancel}>Cancel</Button> <ActionButton primary on:click={save}>Save</ActionButton>
</ButtonGroup> <ActionButton alert on:click={cancel}>Cancel</ActionButton>
</ButtonGroup>
</div>
</div> </div>
<style> <style>

View File

@ -23,7 +23,7 @@
} }
</script> </script>
<h3 class="title">Triggers</h3> <h3 class="budibase__title--3">Triggers</h3>
{#if $store.triggers} {#if $store.triggers}
<table class="fields-table uk-table uk-table-small uk-table-striped"> <table class="fields-table uk-table uk-table-small uk-table-striped">

View File

@ -29,12 +29,12 @@
} }
.button { .button {
font-size: 18px; font-size: 14px;
font-weight: bold; font-weight: bold;
border-radius: 5px; border-radius: 5px;
border: none; border: none;
width: 167px; width: 120px;
height: 64px; height: 45px;
} }
.button:hover { .button:hover {

View File

@ -8,18 +8,9 @@
<style> <style>
.root { .root {
display: flex; display: grid;
} grid-auto-flow: column;
grid-gap: 5px;
.root:last-child { width: 10%;
border-radius: 0 var(--borderradius) var(--borderradius) 0;
}
.root:first-child {
border-radius: var(--borderradius) 0 0 var(--borderradius);
}
.root:not(:first-child):not(:last-child) {
border-radius: 0;
} }
</style> </style>

View File

@ -4,7 +4,7 @@
export let label = "" export let label = ""
</script> </script>
<div>{label}</div> <div class="header">{label}</div>
<textarea class="uk-textarea" bind:value={text} /> <textarea class="uk-textarea" bind:value={text} />
<style> <style>

View File

@ -1,41 +1,40 @@
<script> <script>
import Button from "./Button.svelte" import Button from "./Button.svelte"
import ButtonGroup from "./ButtonGroup.svelte" import ActionButton from "./ActionButton.svelte"
import UIkit from "uikit" import ButtonGroup from "./ButtonGroup.svelte"
import UIkit from "uikit"
export let title="" export let title = ""
export let body="" export let body = ""
export let okText = "OK" export let okText = "OK"
export let cancelText = "Cancel" export let cancelText = "Cancel"
export let onOk = ()=> {} export let onOk = () => {}
export let onCancel = ()=> {} export let onCancel = () => {}
export const show = () => { export const show = () => {
UIkit.modal(theModal).show() UIkit.modal(theModal).show()
} }
export const hide = () => { export const hide = () => {
UIkit.modal(theModal).hide() UIkit.modal(theModal).hide()
} }
let theModal; let theModal
const cancel = () => { const cancel = () => {
hide() hide()
onCancel() onCancel()
} }
const ok = () => {
hide()
onOk()
}
const ok = () => {
hide()
onOk()
}
</script> </script>
<div id="my-id" uk-modal bind:this={theModal}> <div id="my-id" uk-modal bind:this={theModal}>
<div class="uk-modal-dialog"> <div class="uk-modal-dialog">
<button class="uk-modal-close-default" type="button" uk-close></button> <button class="uk-modal-close-default" type="button" uk-close />
<div class="uk-modal-header"> <div class="uk-modal-header">
<h2 class="uk-modal-title">{title}</h2> <h2 class="uk-modal-title">{title}</h2>
</div> </div>
@ -44,14 +43,9 @@ const ok = () => {
</div> </div>
<div class="uk-modal-footer"> <div class="uk-modal-footer">
<ButtonGroup> <ButtonGroup>
<Button grouped color="primary" on:click={ok}> <ActionButton primary on:click={ok}>{okText}</ActionButton>
{okText} <ActionButton error on:click={cancel}>{cancelText}</ActionButton>
</Button> </ButtonGroup>
<Button grouped color="secondary" on:click={cancel}>
{cancelText}
</Button>
</ButtonGroup>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,6 @@
<script> <script>
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import Select from "../common/Select.svelte";
export let selected export let selected
export let label export let label
@ -17,7 +18,7 @@
<label class="uk-form-label">{label}</label> <label class="uk-form-label">{label}</label>
<div class="uk-form-controls"> <div class="uk-form-controls">
{#if multiple} {#if multiple}
<select <Select
class="uk-select uk-form-width-{width} uk-form-{size}" class="uk-select uk-form-width-{width} uk-form-{size}"
multiple multiple
bind:value={selected} bind:value={selected}
@ -27,9 +28,9 @@
{!textMember ? option : textMember(option)} {!textMember ? option : textMember(option)}
</option> </option>
{/each} {/each}
</select> </Select>
{:else} {:else}
<select <Select
class="uk-select uk-form-width-{width} uk-form-{size}" class="uk-select uk-form-width-{width} uk-form-{size}"
bind:value={selected} bind:value={selected}
on:change> on:change>
@ -38,7 +39,7 @@
{!textMember ? option : textMember(option)} {!textMember ? option : textMember(option)}
</option> </option>
{/each} {/each}
</select> </Select>
{/if} {/if}
</div> </div>
</div> </div>

View File

@ -17,7 +17,7 @@
class="dropdown-content" class="dropdown-content"
style="display: {isDroppedDown ? 'inline-block' : 'none'}"> style="display: {isDroppedDown ? 'inline-block' : 'none'}">
{#each actions as action} {#each actions as action}
<div class="action-row" on:click={action.onclick}>{action.label}</div> <div class="budibase__nav-item" on:click={action.onclick}>{action.label}</div>
{/each} {/each}
</div> </div>

View File

@ -1,5 +1,6 @@
<script> <script>
import UIkit from "uikit" import UIkit from "uikit"
import ActionButton from "../common/ActionButton.svelte"
export let isOpen = false export let isOpen = false
export let onClosed = () => {} export let onClosed = () => {}

View File

@ -0,0 +1,5 @@
<script>
export let ratio = "4.5"
</script>
<span uk-spinner={`ratio: ${ratio}`} />

View File

@ -13,7 +13,7 @@
<label class="uk-form-label">{label}</label> <label class="uk-form-label">{label}</label>
<div class="uk-form-controls"> <div class="uk-form-controls">
<input <input
class="uk-input uk-form-width-{width} uk-form-{size}" class="budibase__input"
class:uk-form-danger={hasError} class:uk-form-danger={hasError}
on:change on:change
bind:value={text} bind:value={text}

View File

@ -1,5 +1,6 @@
<script> <script>
import Button from "../common/Button.svelte" import Button from "../common/Button.svelte"
import ActionButton from "../common/ActionButton.svelte"
import ButtonGroup from "../common/ButtonGroup.svelte" import ButtonGroup from "../common/ButtonGroup.svelte"
import { store } from "../builderStore" import { store } from "../builderStore"
import Modal from "../common/Modal.svelte" import Modal from "../common/Modal.svelte"
@ -20,14 +21,14 @@
<div class="root" style="left: {left}"> <div class="root" style="left: {left}">
<ButtonGroup> <ButtonGroup>
<Button color="secondary" grouped on:click={store.saveCurrentNode}> <ActionButton color="secondary" grouped on:click={store.saveCurrentNode}>
{#if $store.currentNodeIsNew}Create{:else}Update{/if} {#if $store.currentNodeIsNew}Create{:else}Update{/if}
</Button> </ActionButton>
{#if !$store.currentNodeIsNew} {#if !$store.currentNodeIsNew}
<Button color="tertiary" grouped on:click={openConfirmDelete}> <ActionButton alert grouped on:click={openConfirmDelete}>
Delete Delete
</Button> </ActionButton>
{/if} {/if}
</ButtonGroup> </ButtonGroup>
@ -38,14 +39,14 @@
{/if} {/if}
<Modal bind:isOpen={confirmDelete}> <Modal bind:isOpen={confirmDelete}>
<div style="margin: 10px 0px 20px 0px"> <div class="actions-modal-body">
Are you sure you want to delete {$store.currentNode.name} ? Are you sure you want to delete {$store.currentNode.name} ?
</div> </div>
<div style="float:right"> <div class="uk-modal-footer uk-text-right">
<Button color="primary" on:click={deleteCurrentNode}>Yes</Button> <ActionButton alert on:click={deleteCurrentNode}>Yes</ActionButton>
<Button color="secondary" on:click={() => (confirmDelete = false)}> <ActionButton primary on:click={() => (confirmDelete = false)}>
No No
</Button> </ActionButton>
</div> </div>
</Modal> </Modal>
</div> </div>
@ -56,4 +57,11 @@
width: 100%; width: 100%;
align-items: right; align-items: right;
} }
.actions-modal-body {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
</style> </style>

View File

@ -7,6 +7,7 @@
import ValuesList from "../common/ValuesList.svelte" import ValuesList from "../common/ValuesList.svelte"
import ErrorsBox from "../common/ErrorsBox.svelte" import ErrorsBox from "../common/ErrorsBox.svelte"
import Checkbox from "../common/Checkbox.svelte" import Checkbox from "../common/Checkbox.svelte"
import ActionButton from "../common/ActionButton.svelte"
import DatePicker from "../common/DatePicker.svelte" import DatePicker from "../common/DatePicker.svelte"
import { import {
cloneDeep, cloneDeep,
@ -141,18 +142,14 @@
label="Max Length" label="Max Length"
bind:value={clonedField.typeOptions.maxLength} /> bind:value={clonedField.typeOptions.maxLength} />
{/if} {/if}
</form> </form>
<ButtonGroup style="float: right;"> <div class="uk-modal-footer uk-text-right">
<Button color="primary" grouped on:click={save}>Save</Button> <ButtonGroup>
<Button color="tertiary" grouped on:click={() => onFinished(false)}> <ActionButton primary on:click={save}>Save</ActionButton>
Cancel <ActionButton alert on:click={() => onFinished(false)}>
</Button> Cancel
</ButtonGroup> </ActionButton>
</ButtonGroup>
</div> </div>
</div>
<style>
</style>

View File

@ -94,7 +94,7 @@
<div class="root"> <div class="root">
<form class="uk-form-horizontal"> <form class="uk-form-horizontal">
<h3 class="settings-title">Settings</h3> <h3 class="budibase__title--3">Settings</h3>
<Textbox label="Name:" bind:text={record.name} on:change={nameChanged} /> <Textbox label="Name:" bind:text={record.name} on:change={nameChanged} />
{#if !record.isSingle} {#if !record.isSingle}
@ -104,7 +104,7 @@
<div class="recordkey">{record.nodeKey()}</div> <div class="recordkey">{record.nodeKey()}</div>
</form> </form>
<h3 class="title"> <h3 class="budibase__title--3">
Fields Fields
<span class="add-field-button" on:click={newField}> <span class="add-field-button" on:click={newField}>
{@html getIcon('plus')} {@html getIcon('plus')}
@ -160,7 +160,7 @@
</Modal> </Modal>
{/if} {/if}
<h3 class="title">Indexes</h3> <h3 class="budibase__title--3">Indexes</h3>
{#each record.indexes as index} {#each record.indexes as index}
<div class="index-container"> <div class="index-container">
@ -199,15 +199,6 @@
padding: 2rem; padding: 2rem;
} }
.settings-title {
font-weight: 700;
}
.title {
margin: 3rem 0rem 0rem 0rem;
font-weight: 700;
}
.recordkey { .recordkey {
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;

View File

@ -101,3 +101,90 @@ h5 {
font-size: 12pt; font-size: 12pt;
color: var(--darkslate); color: var(--darkslate);
} }
/* Budibase Component Styles */
.header {
font-size: 0.75rem;
color: #999;
text-transform: uppercase;
margin-top: 1rem;
font-weight: 500;
}
.budibase__title {
font-weight: 900;
font-size: 42px;
}
.budibase__title--2 {
font-weight: 700;
font-size: 32px;
}
.budibase__title--3 {
font-weight: 700;
font-size: 24px;
}
.budibase__title--4 {
font-weight: 700;
font-size: 18px;
}
.budibase__label--big {
font-weight: 400;
font-size: 14px;
opacity: 0.6;
text-transform: uppercase;
}
.budibase__label--medium {
font-weight: 500;
font-size: 12px;
opacity: 0.6;
text-transform: uppercase;
}
.budibase__label--small {
font-weight: 500;
font-size: 10px;
opacity: 0.6;
text-transform: uppercase;
}
.budibase__sub-heading {
}
.budibase__nav-item {
cursor: pointer;
padding: 0 7px 0 3px;
height: 35px;
margin: 5px 0;
border-radius: 0 5px 5px 0;
display: flex;
align-items: center;
font-weight: 500;
}
.budibase__nav-item.selected {
color: var(--button-text);
background: var(--background-button) !important;
}
.budibase__nav-item:hover {
background: #fafafa;
}
.budibase__input {
width: 250px;
height: 50px;
border-radius: 3px;
border: 1px solid #DBDBDB;
text-align: left;
letter-spacing: 0.7px;
color: #163057;
font-size: 16px;
padding-left: 5px;
}

View File

@ -105,9 +105,8 @@
.nav-group-header { .nav-group-header {
display: grid; display: grid;
grid-template-columns: [icon] auto [title] 1fr [button] auto; grid-template-columns: [icon] auto [title] 1fr [button] auto;
padding: 2rem 1rem 0rem 1rem; padding: 2rem 1rem 1rem 1rem;
font-size: 0.9rem; font-size: 0.9rem;
font-weight: bold;
} }
.nav-group-header > div:nth-child(1) { .nav-group-header > div:nth-child(1) {
@ -137,6 +136,7 @@
.hierarchy-title { .hierarchy-title {
flex: auto 1 1; flex: auto 1 1;
text-transform: uppercase;
} }
.hierarchy { .hierarchy {

View File

@ -13,16 +13,14 @@
if (s.currentNode) if (s.currentNode)
navActive = navActive =
s.activeNav === "database" && node.nodeId === s.currentNode.nodeId s.activeNav === "database" && node.nodeId === s.currentNode.nodeId
? "active"
: ""
}) })
</script> </script>
<div class="root"> <div
<div class="budibase__nav-item"
class="title {navActive}" on:click={() => store.selectExistingNode(node.nodeId)}
on:click={() => store.selectExistingNode(node.nodeId)} class:selected={navActive}>
style="padding-left: {20 + level * 20}px"> <div style="padding-left: {20 + level * 20}px">
{@html getIcon(icon, 12)} {@html getIcon(icon, 12)}
<span style="margin-left: 1rem">{node.name}</span> <span style="margin-left: 1rem">{node.name}</span>
</div> </div>
@ -36,28 +34,4 @@
<svelte:self node={index} level={level + 1} type="index" /> <svelte:self node={index} level={level + 1} type="index" />
{/each} {/each}
{/if} {/if}
</div> </div>
<style>
.root {
display: block;
font-size: 0.9rem;
width: 100%;
cursor: pointer;
color: var(--secondary50);
font-weight: 500;
}
.title {
padding-top: 0.5rem;
padding-right: 0.5rem;
}
.title:hover {
background-color: var(--secondary10);
}
.active {
background-color: var(--primary10);
}
</style>

View File

@ -8,28 +8,10 @@
let navActive = "" let navActive = ""
store.subscribe(db => { store.subscribe(db => {
navActive = db.activeNav === name ? "active" : "" navActive = db.activeNav === name
}) })
const setActive = () => store.setActiveNav(name) const setActive = () => store.setActiveNav(name)
</script> </script>
<div class="nav-item {navActive}" on:click={setActive}>{label}</div> <div class="budibase__nav-item" class:selected={navActive} on:click={setActive}>{label}</div>
<style>
.nav-item {
padding: 1.5rem 1rem 0rem 1rem;
font-size: 0.9rem;
font-weight: bold;
cursor: pointer;
flex: 0 0 auto;
}
.nav-item:hover {
background-color: var(--primary10);
}
.active {
background-color: var(--primary10);
}
</style>

View File

@ -56,7 +56,7 @@
{#each _screens as screen} {#each _screens as screen}
<div <div
class="hierarchy-item component" class="budibase__nav-item component"
class:selected={$store.currentComponentInfo._id === screen.component.props._id} class:selected={$store.currentComponentInfo._id === screen.component.props._id}
on:click|stopPropagation={() => store.setCurrentScreen(screen.title)}> on:click|stopPropagation={() => store.setCurrentScreen(screen.title)}>
@ -99,30 +99,9 @@
<style> <style>
.root { .root {
font-weight: 400; font-weight: 400;
font-size: 0.8rem;
color: #333; color: #333;
} }
.hierarchy-item {
cursor: pointer;
padding: 0 7px 0 3px;
height: 35px;
margin: 5px 0;
border-radius: 0 5px 5px 0;
display: flex;
align-items: center;
font-weight: 500;
}
.hierarchy-item:hover {
background: #fafafa;
}
.selected {
color: var(--button-text);
background: var(--background-button) !important;
}
.title { .title {
margin-left: 10px; margin-left: 10px;
margin-top: 2px; margin-top: 2px;

View File

@ -38,7 +38,7 @@
{#each components as component, index (component._id)} {#each components as component, index (component._id)}
<li on:click|stopPropagation={() => onSelect(component)}> <li on:click|stopPropagation={() => onSelect(component)}>
<div <div
class="item" class="budibase__nav-item item"
class:selected={currentComponent === component} class:selected={currentComponent === component}
style="padding-left: {level * 20 + 53}px"> style="padding-left: {level * 20 + 53}px">
<div>{get_capitalised_name(component._component)}</div> <div>{get_capitalised_name(component._component)}</div>
@ -98,7 +98,6 @@
border-radius: 3px; border-radius: 3px;
height: 35px; height: 35px;
align-items: center; align-items: center;
font-size: 0.8rem;
font-weight: normal; font-weight: normal;
} }
@ -129,12 +128,6 @@
color: var(--button-text); color: var(--button-text);
} }
.selected {
color: var(--button-text);
background: var(--background-button) !important;
font-weight: 500;
}
.reorder-buttons { .reorder-buttons {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -34,10 +34,17 @@
let selectedEvent = null let selectedEvent = null
$: { $: {
const componentDefinition = components.find(c => c.name === component._component) const componentDefinition = components.find(
c => c.name === component._component
)
events = Object.keys(componentDefinition.props) events = Object.keys(componentDefinition.props)
.filter(propName => componentDefinition.props[propName].type === EVENT_TYPE) .filter(
.map(propName => ({ name: propName, handlers: (component[propName] || []) })) propName => componentDefinition.props[propName].type === EVENT_TYPE
)
.map(propName => ({
name: propName,
handlers: component[propName] || [],
}))
} }
const openModal = event => { const openModal = event => {
@ -61,7 +68,8 @@
{#each events as event, index} {#each events as event, index}
{#if event.handlers.length > 0} {#if event.handlers.length > 0}
<div <div
class="handler-container hierarchy-item {selectedEvent && selectedEvent.index === index ? 'selected' : ''}" class:selected={selectedEvent && selectedEvent.index === index}
class="handler-container budibase__nav-item"
on:click={() => openModal({ ...event, index })}> on:click={() => openModal({ ...event, index })}>
<span class="event-name">{event.name}</span> <span class="event-name">{event.name}</span>
<span class="edit-text">EDIT</span> <span class="edit-text">EDIT</span>
@ -109,19 +117,6 @@
height: 80px; height: 80px;
} }
.hierarchy-item {
cursor: pointer;
padding: 11px 7px;
margin: 5px 0;
border-radius: 5px;
font-size: 1.5em;
width: 100%;
}
.hierarchy-item:hover {
background: #f9f9f9;
}
.event-name { .event-name {
margin-top: 5px; margin-top: 5px;
font-weight: bold; font-weight: bold;

View File

@ -51,12 +51,12 @@
} }
</script> </script>
<div class="root"> <div
<div class="budibase__nav-item"
class="hierarchy-item component" class:selected={$store.currentComponentInfo._id === _layout.component.props._id}
class:selected={$store.currentComponentInfo._id === _layout.component.props._id} on:click|stopPropagation={() => store.setScreenType('page')}>
on:click|stopPropagation={() => store.setScreenType('page')}>
<div class="component">
<span <span
class="icon" class="icon"
class:rotate={$store.currentPreviewItem.name !== _layout.title}> class:rotate={$store.currentPreviewItem.name !== _layout.title}>
@ -92,32 +92,6 @@
onOk={() => store.deleteComponent(componentToDelete)} /> onOk={() => store.deleteComponent(componentToDelete)} />
<style> <style>
.root {
font-weight: 400;
font-size: 0.8rem;
color: #333;
}
.hierarchy-item {
cursor: pointer;
padding: 0 7px 0 3px;
height: 35px;
margin: 5px 0;
border-radius: 0 5px 5px 0;
display: flex;
align-items: center;
font-weight: 500;
}
.hierarchy-item:hover {
background: #fafafa;
}
.selected {
color: var(--button-text);
background: var(--background-button) !important;
}
.title { .title {
margin-left: 10px; margin-left: 10px;
margin-top: 2px; margin-top: 2px;