platform/plugins/board-resources/src/components/AddPanel.svelte
Alex c8138e0438
Board: Refactor AddPanel with TextAreaEditor (#1720)
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>
2022-05-12 15:00:58 +07:00

42 lines
865 B
Svelte

<script lang="ts">
import { Button, IconAdd, TextAreaEditor } from '@anticrm/ui'
import { createEventDispatcher } from 'svelte'
import board from '../plugin'
const dispatch = createEventDispatcher()
let isOpened = false
let value = ''
async function onAdd () {
if (!value) return
dispatch('add', value)
value = ''
isOpened = false
}
</script>
<div class="flex-col min-w-80 step-lr75">
{#if isOpened}
<TextAreaEditor
bind:value
placeholder={board.string.NewListPlaceholder}
submitLabel={board.string.AddList}
on:submit={onAdd}
on:cancel={() => {
isOpened = false
}}
/>
{:else}
<Button
icon={IconAdd}
label={board.string.NewList}
justify={'left'}
kind={'transparent'}
on:click={() => {
isOpened = true
}}
/>
{/if}
</div>