0
0
Fork 0

Add calendar wrapper

This commit is contained in:
William Buezas 2024-04-16 09:28:48 -03:00
parent 6019c7f7b2
commit 51eba2ea77
2 changed files with 98 additions and 29 deletions

View File

@ -0,0 +1,66 @@
<script setup>
import { computed } from 'vue';
import { useQuasar } from 'quasar';
import '@quasar/quasar-ui-qcalendar/src/QCalendarVariables.sass';
const $props = defineProps({
bordered: {
type: Boolean,
default: false,
},
transparentBackground: {
type: Boolean,
default: false,
},
});
const $q = useQuasar();
const containerClasses = computed(() => {
const classes = ['main-container-background'];
if ($props.bordered) classes.push('--bordered');
if ($props.transparentBackground) classes.push('transparent-background');
else classes.push($q.dark.isActive ? '--dark' : '--light');
return classes;
});
</script>
<template>
<div :class="containerClasses">
<div class="nav-container row"><slot name="header" /></div>
<slot name="calendar" />
</div>
</template>
<style lang="scss">
.main-container-background {
--calendar-current-background-dark: transparent;
&.--dark {
background-color: var(--calendar-background-dark);
}
&.--light {
background-color: var(--calendar-background);
}
&.--bordered {
border: 1px solid black;
}
}
.transparent-background {
--calendar-background-dark: transparent;
--calendar-background: transparent;
--calendar-outside-background-dark: transparent;
}
.nav-container {
display: flex;
align-items: center;
&.--bordered {
border: 1px solid black;
}
}
</style>

View File

@ -3,6 +3,7 @@ import { ref, computed, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js'; import { QCalendarMonth } from '@quasar/quasar-ui-qcalendar/src/index.js';
import QCalendarMonthWrapper from 'src/components/ui/QCalendarMonthWrapper.vue';
const $props = defineProps({ const $props = defineProps({
modelValue: { modelValue: {
@ -121,29 +122,33 @@ const paintWorkWeeks = async () => {
</script> </script>
<template> <template>
<div :class="['main-container-background', $q.dark.isActive ? '--dark' : '--light']"> <QCalendarMonthWrapper>
<div class="nav-container row"> <template #header>
<QIcon name="arrow_back_ios" class="nav-arrow col" @click="onPrev" /> <div class="row items-center full-width">
<span class="col-6 text-no-wrap text-center text-subtitle1">{{ <QIcon name="arrow_back_ios" class="nav-arrow col" @click="onPrev" />
formattedNavigationLabel <span class="col-6 text-no-wrap text-center text-subtitle1">{{
}}</span> formattedNavigationLabel
<QIcon name="arrow_forward_ios" class="nav-arrow col" @click="onNext" /> }}</span>
</div> <QIcon name="arrow_forward_ios" class="nav-arrow col" @click="onNext" />
<QCalendarMonth </div>
ref="calendarRef" </template>
v-model="value" <template #calendar>
show-work-weeks <QCalendarMonth
:weekdays="[1, 2, 3, 4, 5, 6, 0]" ref="calendarRef"
:selected-dates="selectedDates" v-model="value"
:locale="locale" show-work-weeks
mini-mode :weekdays="[1, 2, 3, 4, 5, 6, 0]"
enable-outside-days :selected-dates="selectedDates"
no-active-date :locale="locale"
class="q-py-md" mini-mode
@click-date="clickDate" enable-outside-days
@moved="onMoved" class="q-py-sm"
/> no-active-date
</div> @click-date="clickDate"
@moved="onMoved"
/>
</template>
</QCalendarMonthWrapper>
</template> </template>
<style lang="scss"> <style lang="scss">
@ -169,17 +174,15 @@ const paintWorkWeeks = async () => {
color: #d19b25; color: #d19b25;
} }
.nav-container {
display: flex;
margin-bottom: 8px;
align-items: center;
}
.nav-arrow { .nav-arrow {
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
} }
.q-calendar-month__head--weekday {
text-transform: capitalize;
}
.q-calendar__button { .q-calendar__button {
&:hover { &:hover {
background-color: var(--vn-accent-color); background-color: var(--vn-accent-color);