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,14 +122,17 @@ 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>
<div class="row items-center full-width">
<QIcon name="arrow_back_ios" class="nav-arrow col" @click="onPrev" /> <QIcon name="arrow_back_ios" class="nav-arrow col" @click="onPrev" />
<span class="col-6 text-no-wrap text-center text-subtitle1">{{ <span class="col-6 text-no-wrap text-center text-subtitle1">{{
formattedNavigationLabel formattedNavigationLabel
}}</span> }}</span>
<QIcon name="arrow_forward_ios" class="nav-arrow col" @click="onNext" /> <QIcon name="arrow_forward_ios" class="nav-arrow col" @click="onNext" />
</div> </div>
</template>
<template #calendar>
<QCalendarMonth <QCalendarMonth
ref="calendarRef" ref="calendarRef"
v-model="value" v-model="value"
@ -138,12 +142,13 @@ const paintWorkWeeks = async () => {
:locale="locale" :locale="locale"
mini-mode mini-mode
enable-outside-days enable-outside-days
class="q-py-sm"
no-active-date no-active-date
class="q-py-md"
@click-date="clickDate" @click-date="clickDate"
@moved="onMoved" @moved="onMoved"
/> />
</div> </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);