Changed calendar layout for buttons

This commit is contained in:
Alexis
2025-04-23 16:21:51 +02:00
parent 048413286f
commit 707d4374ef
5 changed files with 29 additions and 9 deletions

View File

@@ -37,7 +37,7 @@ const useIdFunction = () => useId()
<div class="h-full grid grid-cols-[auto_1fr] dark:bg-black transition-colors"> <div class="h-full grid grid-cols-[auto_1fr] dark:bg-black transition-colors">
<Sidebar /> <Sidebar />
<div class="wrapper shadow-body-light dark:shadow-body-dark transition-all"> <div class="wrapper max-h-screen shadow-body-light dark:shadow-body-dark transition-all">
<NuxtPage /> <NuxtPage />
</div> </div>
</div> </div>

View File

@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
import { PhPlus } from "@phosphor-icons/vue"; import { PhPlus } from "@phosphor-icons/vue";
const isDialogOpen = ref<boolean>(false); const isDialogOpen = ref<boolean>(false);
@@ -15,13 +16,21 @@ function toggleDialog() {
function handleClosing() { function handleClosing() {
setTimeout(() => resetSkeleton(), 100) setTimeout(() => resetSkeleton(), 100)
} }
const breakpoints = useBreakpoints(
breakpointsTailwind
)
</script> </script>
<template> <template>
<UiButton @click="toggleDialog"> <UiButton
<PhPlus size="18" weight="bold" /> class="max-md:fixed max-md:bottom-16 max-md:right-8 max-md:z-50 max-md:size-12 max-md:shadow"
:size="breakpoints.lg.value ? 'default' : 'icon'"
@click="toggleDialog"
>
<PhPlus :size="breakpoints.md.value ? 18 : 24" weight="bold" />
<strong class="font-semibold"> <strong class="font-semibold max-lg:hidden">
{{ $t("entity.calendar.event.newEvent") }} {{ $t("entity.calendar.event.newEvent") }}
</strong> </strong>
</UiButton> </UiButton>

View File

@@ -1,10 +1,15 @@
<script lang="ts" setup> <script lang="ts" setup>
import { breakpointsTailwind, useBreakpoints } from "@vueuse/core"
import { useCalendar } from "~/stores/CalendarStore" import { useCalendar } from "~/stores/CalendarStore"
import { PhMagnifyingGlass } from "@phosphor-icons/vue" import { PhMagnifyingGlass } from "@phosphor-icons/vue"
const { revealAdvancedSearch, } = useCalendar() const { revealAdvancedSearch, } = useCalendar()
const { isReadOnly, defaultDate } = storeToRefs(useCalendar()) const { isReadOnly, defaultDate } = storeToRefs(useCalendar())
const breakpoints = useBreakpoints(
breakpointsTailwind
)
</script> </script>
<template> <template>
@@ -24,9 +29,14 @@ const { isReadOnly, defaultDate } = storeToRefs(useCalendar())
<menu class="flex items-center gap-2"> <menu class="flex items-center gap-2">
<li> <li>
<UiButton search-slash @click="revealAdvancedSearch()"> <UiButton
:search-slash="breakpoints.lg.value"
:size="breakpoints.lg.value ? 'default' : 'icon'"
@click="revealAdvancedSearch()"
>
<PhMagnifyingGlass size="20" weight="light" /> <PhMagnifyingGlass size="20" weight="light" />
<span>
<span class="max-lg:hidden">
{{ $t('entity.advancedSearch.title') }} {{ $t('entity.advancedSearch.title') }}
</span> </span>
</UiButton> </UiButton>

View File

@@ -149,8 +149,6 @@ const eventsNotDisplayed: ComputedRef<number> = computed<number>(() => eventsFo
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
// .tile are the direct children of the grid
// We need to get, between each element, a 1px solid line to separate them, for columns and rows
.tile { .tile {
border-right-width: 1px; border-right-width: 1px;
border-bottom-width: 1px; border-bottom-width: 1px;

View File

@@ -6,6 +6,9 @@ const { currentDate, decrementViewMonth, incrementViewMonth } = useCalendar()
const { currentMonthData } = storeToRefs(useCalendar()) const { currentMonthData } = storeToRefs(useCalendar())
function handleWheel(e: WheelEvent) { function handleWheel(e: WheelEvent) {
// Prevent scrolling
e.preventDefault()
const isMovingUp = e.deltaY < 0 const isMovingUp = e.deltaY < 0
if (isMovingUp) { if (isMovingUp) {
moveCalendarLeft() moveCalendarLeft()
@@ -24,7 +27,7 @@ const moveCalendarRight = useThrottleFn(() => {
</script> </script>
<template> <template>
<div class="grid grid-cols-10" @wheel="handleWheel"> <div class="grid grid-cols-5 md:grid-cols-7 lg:grid-cols-10" @wheel="handleWheel">
<template v-if="currentMonthData"> <template v-if="currentMonthData">
<CalendarStateMonthlyDayTile <CalendarStateMonthlyDayTile
v-for="day in currentMonthData?.days" v-for="day in currentMonthData?.days"