Add AttributeEditor (#231)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2021-10-04 18:04:25 +03:00 committed by GitHub
parent 4fd981b303
commit f6d1a5f477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 28 deletions

View File

@ -0,0 +1,51 @@
<!--
// Copyright © 2020 Anticrm Platform Contributors.
//
// 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 { Asset, IntlString } from '@anticrm/platform'
import type { AnySvelteComponent } from '@anticrm/ui'
import { CircleButton, Label } from '@anticrm/ui'
export let icon: Asset | AnySvelteComponent | undefined = undefined
export let label: IntlString
export let component: AnySvelteComponent
export let props: any
export let minimize: boolean = false
</script>
{#if icon}
<div class="flex-row-center">
<CircleButton icon={icon} size={'large'} />
{#if !minimize}
<div class="flex-col with-icon">
<Label {label} />
<div class="value"><svelte:component this={component} {...props} /></div>
</div>
{/if}
</div>
{:else}
<div class="flex-col">
<Label {label} />
<div class="value"><svelte:component this={component} {...props} /></div>
</div>
{/if}
<style lang="scss">
.with-icon { margin-left: .5rem; }
.value {
font-weight: 500;
color: var(--theme-caption-color);
}
</style>

View File

@ -17,44 +17,24 @@
import { CircleButton, Label } from '@anticrm/ui'
import Location from './icons/Location.svelte'
import YesNoPresenter from './YesNoPresenter.svelte'
import AttributeEditor from './AttributeEditor.svelte'
export let minimize: boolean = true
export let minimize: boolean = false
</script>
<div class="flex-row-center small-text">
<div class="icon-wrap column">
<CircleButton icon={Location} size={'large'} />
{#if !minimize}
<div class="noicon-column">
<Label label={'Location'} />
<div class="value">Moscow</div>
</div>
{/if}
<div class="column">
<AttributeEditor icon={Location} label={'Location'} component={Label} props={{ label: 'Moscow' }} />
</div>
<div class="noicon-column column">
<Label label={'Onsite'} />
<YesNoPresenter state={'yes'} />
<div class="column">
<AttributeEditor label={'Onsite'} component={YesNoPresenter} props={{ state: 'yes' }} />
</div>
<div class="noicon-column column">
<Label label={'Remote'} />
<YesNoPresenter state={'no'} />
<div class="column">
<AttributeEditor label={'Remote'} component={YesNoPresenter} props={{ state: 'no' }} />
</div>
</div>
<style lang="scss">
.icon-wrap {
display: flex;
align-items: center;
}
.noicon-column {
display: flex;
flex-direction: column;
}
.icon-wrap .noicon-column { margin-left: .5rem; }
.value {
font-weight: 500;
color: var(--theme-caption-color);
}
.column + .column {
position: relative;
margin-left: 3rem;