metis/src/EventModal.svelte

46 lines
1.3 KiB
Svelte
Raw Normal View History

2022-03-06 00:59:36 +01:00
<script>
import { Modal, ModalHeader, ModalBody, ModalFooter, Icon } from 'sveltestrap';
export let event = undefined;
export let open = undefined;
export let toggle = undefined;
2022-03-06 01:44:33 +01:00
const timeFormat = d =>
d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
const dateFormat = d =>
d.toLocaleDateString('fr-FR', { month: '2-digit', day: '2-digit' });
2022-03-06 00:59:36 +01:00
</script>
<Modal isOpen={open} {toggle} centered scrollable>
<ModalHeader {toggle}>{event.title}</ModalHeader>
2022-03-06 10:46:58 +01:00
<ModalBody>
{#if event.extendedProps.description}
2022-03-06 00:59:36 +01:00
{#each event.extendedProps.description.split('\n') as line}
<p>{line}</p>
{/each}
2022-03-06 10:46:58 +01:00
{:else}
<i class="fs-6">Pas de description</i>
{/if}
</ModalBody>
2022-03-06 01:14:43 +01:00
2022-03-06 01:44:33 +01:00
<ModalFooter class="justify-content-between">
<span>
{#if event.extendedProps.location}
<Icon name="geo" />
<span class="ms-1">{event.extendedProps.location}</span>
{/if}
</span>
<span>
{#if event.allDay}
<Icon name="calendar-range" />
<span class="ms-1">{dateFormat(event.start)} - {dateFormat(event.end)}</span>
{:else}
2022-03-06 10:46:58 +01:00
<Icon name="clock-history" />
2022-03-06 01:44:33 +01:00
<span class="ms-1">{timeFormat(event.start)} - {timeFormat(event.end)}</span>
{/if}
</span>
</ModalFooter>
2022-03-06 00:59:36 +01:00
</Modal>