Bring old Dialog back (#96)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2021-08-30 19:27:54 +03:00 committed by GitHub
parent 7056cd454d
commit 481853212d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 162 deletions

View File

@ -1,113 +0,0 @@
<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import type { IntlString } from '@anticrm/platform'
import { createEventDispatcher } from 'svelte'
import Close from './internal/icons/Close.svelte'
import ScrollBox from './ScrollBox.svelte'
import Button from './Button.svelte'
import Label from './Label.svelte'
export let label: IntlString
export let okLabel: IntlString
export let okAction: () => void
const dispatch = createEventDispatcher()
</script>
<div class="dialog-container">
<form class="dialog" on:submit|preventDefault={() => { okAction(); dispatch('close') }}>
<div class="flex-between header">
<div class="title"><Label {label} /></div>
<div class="tool" on:click={() => { dispatch('close') }}><Close size={'small'} /></div>
</div>
<div class="content">
<ScrollBox vertical stretch><slot /></ScrollBox>
</div>
<div class="footer">
<Button label={okLabel} primary />
<Button label={'Cancel'} on:click={() => { dispatch('close') }} />
</div>
</form>
</div>
<style lang="scss">
.dialog-container {
position: relative;
display: flex;
justify-content: space-between;
flex-direction: row-reverse;
width: 100vw;
min-height: 100vh;
max-height: 100vh;
.dialog {
display: flex;
flex-direction: column;
width: 45rem;
min-height: 100vh;
max-height: 100vh;
background-color: var(--theme-bg-color);
border-radius: 1.875rem 0 0 1.875rem;
box-shadow: 0px 3.125rem 7.5rem rgba(0, 0, 0, .4);
.header {
flex-shrink: 0;
padding: 0 2rem 0 2.5rem;
height: 4.5rem;
.title {
flex-grow: 1;
font-weight: 500;
font-size: 1.125rem;
color: var(--theme-caption-color);
user-select: none;
}
.tool {
margin-left: .75rem;
opacity: .4;
cursor: pointer;
&:hover { opacity: 1; }
}
}
.content {
flex-shrink: 0;
flex-grow: 1;
// margin: 0 2.5rem;
height: fit-content;
}
.footer {
flex-shrink: 0;
display: grid;
grid-auto-flow: column;
direction: rtl;
justify-content: start;
align-items: center;
column-gap: .75rem;
padding: 0 2.5rem;
height: 6rem;
mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 1.25rem, rgba(0, 0, 0, 1) 2.5rem);
overflow: hidden;
}
}
}
</style>

View File

@ -31,64 +31,83 @@
const dispatch = createEventDispatcher()
</script>
<form class="dialog" on:submit|preventDefault={() => { okAction(); dispatch('close') }}>
<div class="content">
<ScrollBox vertical stretch><slot /></ScrollBox>
</div>
<!-- <div class="footer">
<Button label={okLabel} primary />
<Button label={'Cancel'} on:click={() => { dispatch('close') }} />
</div> -->
</form>
<div class="dialog-container">
<form class="dialog" on:submit|preventDefault={() => { okAction(); dispatch('close') }}>
<div class="flex-between header">
<div class="title"><Label {label} /></div>
<div class="tool" on:click={() => { dispatch('close') }}><Close size={'small'} /></div>
</div>
<div class="content">
<ScrollBox vertical stretch><slot /></ScrollBox>
</div>
<div class="footer">
<Button label={okLabel} primary />
<Button label={'Cancel'} on:click={() => { dispatch('close') }} />
</div>
</form>
</div>
<style lang="scss">
.dialog {
.dialog-container {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
background-color: var(--theme-bg-color);
border-radius: 1.25rem;
justify-content: space-between;
flex-direction: row-reverse;
width: 100vw;
min-height: 100vh;
max-height: 100vh;
.header {
flex-shrink: 0;
padding: 0 2rem 0 2.5rem;
height: 4.5rem;
.dialog {
display: flex;
flex-direction: column;
width: 45rem;
min-height: 100vh;
max-height: 100vh;
background-color: var(--theme-bg-color);
border-radius: 1.875rem 0 0 1.875rem;
box-shadow: 0px 3.125rem 7.5rem rgba(0, 0, 0, .4);
.title {
.header {
flex-shrink: 0;
padding: 0 2rem 0 2.5rem;
height: 4.5rem;
.title {
flex-grow: 1;
font-weight: 500;
font-size: 1.125rem;
color: var(--theme-caption-color);
user-select: none;
}
.tool {
margin-left: .75rem;
opacity: .4;
cursor: pointer;
&:hover { opacity: 1; }
}
}
.content {
flex-shrink: 0;
flex-grow: 1;
font-weight: 500;
font-size: 1.125rem;
color: var(--theme-caption-color);
user-select: none;
margin: 0 2.5rem;
height: fit-content;
}
.tool {
margin-left: .75rem;
opacity: .4;
cursor: pointer;
&:hover { opacity: 1; }
.footer {
flex-shrink: 0;
display: grid;
grid-auto-flow: column;
direction: rtl;
justify-content: start;
align-items: center;
column-gap: .75rem;
padding: 0 2.5rem;
height: 6rem;
mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 1.25rem, rgba(0, 0, 0, 1) 2.5rem);
overflow: hidden;
}
}
.content {
flex-shrink: 0;
flex-grow: 1;
padding: 0 2.5rem 2.5rem;
height: fit-content;
}
.footer {
flex-shrink: 0;
display: grid;
grid-auto-flow: column;
direction: rtl;
justify-content: start;
align-items: center;
column-gap: .75rem;
padding: 0 2.5rem;
height: 6rem;
mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 1.25rem, rgba(0, 0, 0, 1) 2.5rem);
overflow: hidden;
}
}
</style>