2022-04-22 17:03:47 +02:00
|
|
|
<script>
|
|
|
|
import { Icon, Heading } from "@budibase/bbui"
|
|
|
|
|
|
|
|
export let title
|
2022-05-11 14:06:41 +02:00
|
|
|
export let icon
|
2022-07-25 11:20:59 +02:00
|
|
|
export let expandable = false
|
2022-04-26 09:23:53 +02:00
|
|
|
export let showAddButton = false
|
|
|
|
export let showBackButton = false
|
2022-07-25 11:20:59 +02:00
|
|
|
export let showCloseButton = false
|
2022-04-22 17:03:47 +02:00
|
|
|
export let onClickAddButton
|
2022-04-26 09:23:53 +02:00
|
|
|
export let onClickBackButton
|
2022-07-25 11:20:59 +02:00
|
|
|
export let onClickCloseButton
|
2022-05-11 14:06:41 +02:00
|
|
|
export let borderLeft = false
|
|
|
|
export let borderRight = false
|
2022-04-27 09:06:09 +02:00
|
|
|
|
|
|
|
let wide = false
|
2022-04-22 17:03:47 +02:00
|
|
|
</script>
|
|
|
|
|
2022-05-11 14:09:21 +02:00
|
|
|
<div class="panel" class:wide class:borderLeft class:borderRight>
|
2022-04-22 17:03:47 +02:00
|
|
|
<div class="header">
|
2022-04-26 09:23:53 +02:00
|
|
|
{#if showBackButton}
|
|
|
|
<Icon name="ArrowLeft" hoverable on:click={onClickBackButton} />
|
|
|
|
{/if}
|
2022-05-11 14:06:41 +02:00
|
|
|
{#if icon}
|
|
|
|
<Icon name={icon} />
|
|
|
|
{/if}
|
2022-04-22 17:03:47 +02:00
|
|
|
<div class="title">
|
2022-07-01 13:03:04 +02:00
|
|
|
<Heading size="XXS">{title || ""}</Heading>
|
2022-04-22 17:03:47 +02:00
|
|
|
</div>
|
2022-07-25 11:20:59 +02:00
|
|
|
{#if expandable}
|
2022-04-27 09:06:09 +02:00
|
|
|
<Icon
|
|
|
|
name={wide ? "Minimize" : "Maximize"}
|
|
|
|
hoverable
|
|
|
|
on:click={() => (wide = !wide)}
|
|
|
|
/>
|
|
|
|
{/if}
|
2022-04-22 17:03:47 +02:00
|
|
|
{#if showAddButton}
|
2022-04-25 15:37:14 +02:00
|
|
|
<div class="add-button" on:click={onClickAddButton}>
|
|
|
|
<Icon name="Add" />
|
2022-04-22 17:03:47 +02:00
|
|
|
</div>
|
|
|
|
{/if}
|
2022-07-25 11:20:59 +02:00
|
|
|
{#if showCloseButton}
|
|
|
|
<Icon name="Close" hoverable on:click={onClickCloseButton} />
|
|
|
|
{/if}
|
2022-04-22 17:03:47 +02:00
|
|
|
</div>
|
2022-04-26 14:44:21 +02:00
|
|
|
<div class="body">
|
|
|
|
<slot />
|
|
|
|
</div>
|
2022-04-22 17:03:47 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2022-05-11 14:09:21 +02:00
|
|
|
.panel {
|
2022-07-01 13:47:30 +02:00
|
|
|
width: 260px;
|
2022-12-17 15:13:06 +01:00
|
|
|
flex: 0 0 260px;
|
2022-04-22 17:03:47 +02:00
|
|
|
background: var(--background);
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: stretch;
|
2022-04-27 09:06:09 +02:00
|
|
|
transition: width 130ms ease-out;
|
2022-04-26 09:23:53 +02:00
|
|
|
}
|
2022-05-11 14:09:21 +02:00
|
|
|
.panel.borderLeft {
|
2022-05-11 14:06:41 +02:00
|
|
|
border-left: var(--border-light);
|
|
|
|
}
|
2022-05-11 14:09:21 +02:00
|
|
|
.panel.borderRight {
|
2022-05-11 14:06:41 +02:00
|
|
|
border-right: var(--border-light);
|
|
|
|
}
|
2022-05-11 14:09:21 +02:00
|
|
|
.panel.wide {
|
2022-04-27 09:06:09 +02:00
|
|
|
width: 420px;
|
2022-12-17 15:13:06 +01:00
|
|
|
flex: 0 0 420px;
|
2022-04-22 17:03:47 +02:00
|
|
|
}
|
|
|
|
.header {
|
2022-04-26 09:23:53 +02:00
|
|
|
flex: 0 0 48px;
|
2022-04-22 17:03:47 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
2022-04-25 20:33:43 +02:00
|
|
|
padding: 0 var(--spacing-l);
|
2022-04-22 17:03:47 +02:00
|
|
|
border-bottom: var(--border-light);
|
|
|
|
gap: var(--spacing-l);
|
|
|
|
}
|
|
|
|
.title {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
width: 0;
|
|
|
|
}
|
|
|
|
.title :global(h1) {
|
|
|
|
overflow: hidden;
|
|
|
|
font-weight: 600;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
.add-button {
|
2022-04-25 20:59:30 +02:00
|
|
|
flex: 0 0 30px;
|
|
|
|
height: 30px;
|
2022-04-22 17:03:47 +02:00
|
|
|
display: grid;
|
|
|
|
place-items: center;
|
|
|
|
border-radius: 4px;
|
|
|
|
position: relative;
|
|
|
|
cursor: pointer;
|
|
|
|
background: var(--spectrum-semantic-cta-color-background-default);
|
|
|
|
transition: background var(--spectrum-global-animation-duration-100, 130ms)
|
|
|
|
ease-out;
|
|
|
|
}
|
|
|
|
.add-button:hover {
|
|
|
|
background: var(--spectrum-semantic-cta-color-background-hover);
|
|
|
|
}
|
|
|
|
.add-button :global(svg) {
|
|
|
|
fill: white;
|
|
|
|
}
|
2022-04-26 14:44:21 +02:00
|
|
|
.body {
|
|
|
|
flex: 1 1 auto;
|
|
|
|
overflow: auto;
|
|
|
|
overflow-x: hidden;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: stretch;
|
|
|
|
}
|
2022-04-22 17:03:47 +02:00
|
|
|
</style>
|