2021-08-04 23:31:54 +00:00
|
|
|
<!--
|
|
|
|
// 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 { IntlString } from '@anticrm/platform'
|
|
|
|
import Label from './Label.svelte'
|
|
|
|
import Calendar from './icons/Calendar.svelte'
|
|
|
|
import Close from './icons/Close.svelte'
|
2021-12-02 09:09:37 +00:00
|
|
|
import { DatePopup, showPopup } from '..'
|
2021-08-04 23:31:54 +00:00
|
|
|
|
|
|
|
export let title: IntlString
|
|
|
|
export let selected: Date = new Date(Date.now())
|
|
|
|
export let show: boolean = false
|
2021-12-02 09:09:37 +00:00
|
|
|
let container: HTMLElement
|
2021-08-04 23:31:54 +00:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2021-08-17 14:46:06 +00:00
|
|
|
<div class="flex-row-center">
|
2021-12-02 09:09:37 +00:00
|
|
|
<button
|
|
|
|
class="focused-button btn"
|
|
|
|
class:selected={show}
|
|
|
|
on:click|preventDefault={() => {
|
|
|
|
show = true
|
|
|
|
showPopup(DatePopup, { selected, title }, container, (result) => {
|
|
|
|
if (result) {
|
|
|
|
selected = result
|
|
|
|
}
|
|
|
|
show = false
|
|
|
|
})
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<div class="icon">
|
|
|
|
{#if show}<Close size={'small'} />{:else}<Calendar size={'medium'} />{/if}
|
2021-08-04 23:31:54 +00:00
|
|
|
</div>
|
2021-12-02 09:09:37 +00:00
|
|
|
</button>
|
2021-08-04 23:31:54 +00:00
|
|
|
|
|
|
|
<div class="selectDate">
|
2021-08-17 14:46:06 +00:00
|
|
|
<div class="label"><Label label={title} /></div>
|
2021-08-04 23:31:54 +00:00
|
|
|
<div class="date">
|
|
|
|
{selected.getMonth() + 1} / {selected.getDate()} / {selected.getFullYear()}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2021-08-17 14:46:06 +00:00
|
|
|
.btn {
|
|
|
|
width: 2.25rem;
|
|
|
|
height: 2.25rem;
|
|
|
|
border-radius: .5rem;
|
|
|
|
border: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.selectDate {
|
|
|
|
margin-left: .75rem;
|
|
|
|
.label {
|
|
|
|
font-size: .75rem;
|
|
|
|
font-weight: 500;
|
|
|
|
color: var(--theme-content-accent-color);
|
2021-08-04 23:31:54 +00:00
|
|
|
}
|
2021-08-17 14:46:06 +00:00
|
|
|
.date {
|
|
|
|
color: var(--theme-caption-color);
|
2021-08-04 23:31:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|