Responsive design

This commit is contained in:
Tom Hubrecht 2022-03-06 16:13:05 +01:00
parent 6328c0342e
commit f0db19a89f
2 changed files with 26 additions and 27 deletions

View file

@ -21,11 +21,12 @@
let openModal = false; let openModal = false;
const toggle = () => (openModal = !openModal); const toggle = () => (openModal = !openModal);
const mobile = window.innerWidth < 765;
let calendar; let calendar;
let options = writable({ let options = writable({
initialView: window.innerWidth < 765 ? 'listWeek' : 'timeGridWeek', initialView: mobile ? 'listWeek' : 'timeGridWeek',
plugins: [ plugins: [
timeGridPlugin, timeGridPlugin,
dayGridPlugin, dayGridPlugin,
@ -37,9 +38,11 @@
locale: frLocale, locale: frLocale,
allDayContent: '', allDayContent: '',
headerToolbar: { headerToolbar: {
left: 'prev,next today', left: mobile ? false : 'prev,next today',
center: 'title', center: 'title',
right: 'dayGridMonth,timeGridWeek,listWeek' right: mobile
? 'prev,today,next dayGridMonth,timeGridWeek,listWeek'
: 'dayGridMonth,timeGridWeek,listWeek'
}, },
height: '100%', height: '100%',
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives', schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
@ -49,7 +52,11 @@
openModal = true; openModal = true;
event.set(info.event); event.set(info.event);
}, },
titleFormat: { year: '2-digit', month: 'numeric', day: 'numeric' }, titleFormat: {
year: mobile ? '2-digit' : 'numeric',
month: mobile ? 'numeric' : 'long',
day: 'numeric'
},
events: [], events: [],
themeSystem: 'bootstrap5' themeSystem: 'bootstrap5'
}); });
@ -82,8 +89,8 @@
$: updateEvents(selectedCalendars); $: updateEvents(selectedCalendars);
</script> </script>
<div class="app-container"> <div class="h-100 d-flex flex-column">
<h1 class="title">Calendrier de la vie étudiante à l'ENS</h1> <h1 class="mt-3 title text-center">Calendrier de la vie étudiante à l'ENS</h1>
<FilterBar {calendarTree} bind:selected={selectedCalendars} /> <FilterBar {calendarTree} bind:selected={selectedCalendars} />
@ -95,28 +102,20 @@
<EventModal event={$event} open={openModal} {toggle} /> <EventModal event={$event} open={openModal} {toggle} />
</div> </div>
<div class="fc-toolbar-title" />
<style> <style>
main { @media (max-width: 765px) {
text-align: center; :global(.fc-header-toolbar) {
padding: 1em; flex-direction: column;
max-width: 240px; }
margin: 0 auto; :global(.fc-toolbar-title) {
} margin-bottom: 0.25em !important;
}
.title { :global(.fc-toolbar-chunk) {
text-align: center; display: flex;
} justify-content: space-evenly;
width: 100%;
.app-container {
display: flex;
flex-flow: column;
height: 100%;
}
@media (min-width: 640px) {
main {
max-width: none;
} }
} }
</style> </style>

View file

@ -11,7 +11,7 @@
const toggle = () => (open = !open); const toggle = () => (open = !open);
</script> </script>
<Button on:click={toggle} class="my-2"> <Button on:click={toggle} class="mb-3 col-6 mx-auto">
<span class="me-2">Sélection des calendriers</span> <span class="me-2">Sélection des calendriers</span>
<Icon name="chevron-double-right" /> <Icon name="chevron-double-right" />
</Button> </Button>