Skip to content

Commit ff0160e

Browse files
committed
refactor(reservation): improve layout
1 parent af409c9 commit ff0160e

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

pages/manage/reservation.vue

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<script setup lang="ts">
22
import type { ClassroomData } from '@prisma/client'
33
import { Button } from '@/components/ui/button'
4+
import {
5+
Card,
6+
CardContent,
7+
CardDescription,
8+
CardHeader,
9+
CardTitle,
10+
} from '@/components/ui/card'
411
import Toaster from '@/components/ui/toast/Toaster.vue'
512
import { useToast } from '@/components/ui/toast/use-toast'
613
import { LoaderCircle } from 'lucide-vue-next'
@@ -132,21 +139,21 @@ async function handleSubmit(e: any) {
132139
</script>
133140

134141
<template>
135-
<div>
136-
<div class="inline-block align-top w-full lg:w-1/2 lg:max-w-[480px] p-5">
137-
<div class="text-2xl">
138-
预约教室
139-
</div>
140-
<div class="py-5" />
142+
<Card>
143+
<CardHeader>
144+
<CardTitle>预约教室</CardTitle>
145+
<CardDescription>在此处预约教室</CardDescription>
146+
</CardHeader>
147+
<CardContent>
141148
<form class="space-y-2" @submit="handleSubmit">
142149
<FormField name="main">
143150
<FormItem>
144151
<FormLabel>预约时间</FormLabel>
145152
<FormControl>
146-
<div class="flex flex-col lg:flex-row lg:justify-stretch">
153+
<div class="flex flex-col sm:flex-row space-y-2 sm:space-y-0 sm:space-x-1 justify-start">
147154
<!-- This ToggleGroup should be implemented in a better way but anyway it works -->
148-
<ToggleGroup :key="reloadKey" type="multiple" variant="outline" class="w-fit">
149-
<div class="text-center w-10">
155+
<ToggleGroup :key="reloadKey" type="multiple" variant="outline">
156+
<div class="text-muted-foreground text-sm text-center w-7">
150157
每周
151158
</div>
152159
<ToggleGroupItem value="mon" @click="day[1] = !day[1]">
@@ -178,6 +185,7 @@ async function handleSubmit(e: any) {
178185
</div>
179186
</FormControl>
180187
</FormItem>
188+
<div class="py-1" />
181189
<FormItem>
182190
<FormLabel>选择教室</FormLabel>
183191
<div v-if="!clubs || !data">
@@ -209,7 +217,7 @@ async function handleSubmit(e: any) {
209217
</Select>
210218
</FormControl>
211219
</FormItem>
212-
<div class="py-2" />
220+
<div class="py-1" />
213221
<FormItem>
214222
<FormLabel>社团</FormLabel>
215223
<FormControl>
@@ -245,11 +253,9 @@ async function handleSubmit(e: any) {
245253
</SelectContent>
246254
</Select>
247255
</FormControl>
248-
<FormDescription>
249-
选择一个社团
250-
</FormDescription>
251256
<FormMessage />
252257
</FormItem>
258+
<div class="py-1" />
253259
<FormItem>
254260
<FormLabel>备注</FormLabel>
255261
<FormControl>
@@ -264,11 +270,11 @@ async function handleSubmit(e: any) {
264270
<div class="py-2" />
265271
<Button type="submit" :disabled="pending" class="mr-3">
266272
<LoaderCircle v-if="pending" class="animate-spin mr-2" />
267-
<span v-if="!pending">提交预约申请</span>
273+
<span v-if="!pending">提交预约</span>
268274
<span v-if="pending">处理中...</span>
269275
</Button>
270276
</form>
271-
</div>
272-
</div>
277+
</CardContent>
278+
</Card>
273279
<Toaster />
274280
</template>

0 commit comments

Comments
 (0)