improve DatePicker sizing in report create modal

This commit is contained in:
Gregor Vostrak
2025-05-20 14:56:45 +02:00
parent 09f7fbccf6
commit f1cce79678
5 changed files with 22 additions and 9 deletions

View File

@@ -103,13 +103,13 @@ async function submit() {
<div <div
v-if="report.is_public" v-if="report.is_public"
class="flex items-center space-x-4"> class="flex items-center space-x-4">
<div> <div class="w-full">
<InputLabel for="public_until" value="Expires at" /> <InputLabel for="public_until" value="Expires at" />
<div class="text-text-tertiary font-medium"> <div class="text-text-tertiary font-medium">
(optional) (optional)
</div> </div>
</div> </div>
<DatePicker id="public_until"></DatePicker> <DatePicker id="public_until" size="input"></DatePicker>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -118,7 +118,9 @@ async function submit() {
v-if="report.is_public" v-if="report.is_public"
class="flex items-center space-x-4"> class="flex items-center space-x-4">
<InputLabel for="public_until" value="Expires at" /> <InputLabel for="public_until" value="Expires at" />
<DatePicker id="public_until"></DatePicker> <DatePicker
id="public_until"
size="input"></DatePicker>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -4,7 +4,7 @@ import {
PopoverContent, PopoverContent,
PopoverTrigger, PopoverTrigger,
} from '@/Components/ui/popover'; } from '@/Components/ui/popover';
import { Button } from '@/Components/ui/button'; import { Button, type ButtonVariants } from '@/Components/ui/button';
import { Calendar } from '@/Components/ui/calendar'; import { Calendar } from '@/Components/ui/calendar';
import { CalendarIcon } from 'lucide-vue-next'; import { CalendarIcon } from 'lucide-vue-next';
import { formatDateLocalized } from '@/packages/ui/src/utils/time'; import { formatDateLocalized } from '@/packages/ui/src/utils/time';
@@ -16,6 +16,7 @@ import { getLocalizedDayJs } from '@/packages/ui/src/utils/time';
const props = defineProps<{ const props = defineProps<{
class?: string; class?: string;
tabindex?: string; tabindex?: string;
size: ButtonVariants['size'];
}>(); }>();
const model = defineModel<string | null>(); const model = defineModel<string | null>();
@@ -52,14 +53,21 @@ const organization = inject<ComputedRef<Organization>>('organization');
<PopoverTrigger as-child> <PopoverTrigger as-child>
<Button <Button
variant="input" variant="input"
size="sm" :size="size"
:class="[ :class="[
'w-full gap-1.5 justify-center text-left font-normal', size === 'sm' ? 'gap-1.5' : 'gap-2',
'w-full justify-center text-left font-normal',
!model && 'text-muted-foreground', !model && 'text-muted-foreground',
props.class, props.class,
]" ]"
:tabindex="tabindex"> :tabindex="tabindex">
<CalendarIcon class="h-3 w-3" /> <CalendarIcon
:class="[
size === 'xs' ? 'h-3 w-3' :
size === 'sm' ? 'h-3 w-3' :
size === 'lg' ? 'h-4.5 w-4.5' :
'h-4 w-4'
]" />
<span class="text-center"> <span class="text-center">
{{ {{
model model
@@ -77,8 +85,7 @@ const organization = inject<ComputedRef<Organization>>('organization');
mode="single" mode="single"
:model-value="date" :model-value="date"
:initial-focus="true" :initial-focus="true"
@update:model-value="handleChange" @update:model-value="handleChange" />
/>
</PopoverContent> </PopoverContent>
</Popover> </Popover>
</template> </template>

View File

@@ -84,6 +84,7 @@ watch(focused, (newValue, oldValue) => {
<div class="px-2 pt-2"> <div class="px-2 pt-2">
<DatePicker <DatePicker
v-model="tempStart" v-model="tempStart"
size="sm"
class="text-xs text-text-tertiary max-w-28 px-1.5 py-1.5" class="text-xs text-text-tertiary max-w-28 px-1.5 py-1.5"
@changed="updateTimeEntry"></DatePicker> @changed="updateTimeEntry"></DatePicker>
</div> </div>
@@ -91,6 +92,7 @@ watch(focused, (newValue, oldValue) => {
<DatePicker <DatePicker
v-if="tempEnd !== null" v-if="tempEnd !== null"
v-model="tempEnd" v-model="tempEnd"
size="sm"
class="text-xs text-text-tertiary max-w-28 px-1.5 py-1.5" class="text-xs text-text-tertiary max-w-28 px-1.5 py-1.5"
@changed="updateTimeEntry"></DatePicker> @changed="updateTimeEntry"></DatePicker>
</div> </div>

View File

@@ -257,9 +257,11 @@ type BillableOption = {
</div> </div>
<DatePicker <DatePicker
v-model="localStart" v-model="localStart"
size="sm"
class="text-xs text-text-tertiary max-w-28 px-1.5 py-1.5"></DatePicker> class="text-xs text-text-tertiary max-w-28 px-1.5 py-1.5"></DatePicker>
<DatePicker <DatePicker
v-model="localEnd" v-model="localEnd"
size="sm"
class="text-xs text-text-tertiary max-w-28 px-1.5 py-1.5"></DatePicker> class="text-xs text-text-tertiary max-w-28 px-1.5 py-1.5"></DatePicker>
</div> </div>
</div> </div>