Skip to content

Commit 0a17dca

Browse files
committed
create/update form design
1 parent dd62164 commit 0a17dca

File tree

4 files changed

+102
-12
lines changed

4 files changed

+102
-12
lines changed

src/main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ import Button from 'primevue/button';
2121
import Card from 'primevue/card';
2222
import Message from 'primevue/message';
2323
import Dialog from 'primevue/dialog';
24+
import Fieldset from 'primevue/fieldset';
25+
import InputText from 'primevue/inputtext';
26+
import Dropdown from 'primevue/dropdown';
2427

2528
const app = createApp(App);
2629

@@ -36,5 +39,8 @@ app.component('Button', Button);
3639
app.component('Card', Card);
3740
app.component('Message', Message);
3841
app.component('Dialog', Dialog);
42+
app.component('Fieldset', Fieldset);
43+
app.component('InputText', InputText);
44+
app.component('Dropdown', Dropdown);
3945

4046
app.mount('#app');

src/router/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const routes = [
1717
},
1818
{
1919
path: '/books/:id',
20-
name: 'book detail',
20+
name: 'book-detail',
2121
// props: true
2222
props: parseProps,
2323
component: BookDetailsView

src/views/BookDetailsView.vue

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,81 @@
1-
<template>
2-
<div class="about">
3-
<h1>This is the book details page</h1>
4-
</div>
5-
</template>
1+
<template>
2+
<div class="text-color-secondary text-3xl font-semibold m-5">Edit Book</div>
3+
<Fieldset class="mx-6" legend="Godfather I">
4+
<div class="mb-4">
5+
<label for="id" class="block text-base font-medium mb-2">Id</label>
6+
<InputText id="id" type="text" class="w-full" disabled />
7+
</div>
8+
9+
<div class="mb-4">
10+
<label for="title" class="block text-base font-medium mb-2">Title</label>
11+
<InputText id="title" type="text" class="w-full" />
12+
</div>
13+
14+
<div class="mb-4">
15+
<label for="firstAuthor" class="block text-base font-medium mb-2"
16+
>First Author</label
17+
>
18+
<Dropdown
19+
id="firstAuthor"
20+
placeholder="Select an Author"
21+
class="w-full"
22+
/>
23+
</div>
24+
25+
<div class="mb-4">
26+
<label for="secondAuthor" class="block text-base font-medium mb-2"
27+
>Second Author</label
28+
>
29+
<Dropdown
30+
id="secondAuthor"
31+
placeholder="Select an Author"
32+
class="w-full"
33+
/>
34+
</div>
35+
36+
<div class="mb-4">
37+
<label for="genre" class="block text-base font-medium mb-2"
38+
>Publisher</label
39+
>
40+
<Dropdown id="genre" placeholder="Select a Genre" class="w-full" />
41+
</div>
42+
43+
<div class="mb-4">
44+
<label for="isbn" class="block text-base font-medium mb-2">ISBN</label>
45+
<InputText id="isbn" type="text" class="w-full" />
46+
</div>
47+
48+
<div class="mb-4">
49+
<label for="publisher" class="block text-base font-medium mb-2"
50+
>Genre</label
51+
>
52+
<Dropdown
53+
id="publisher"
54+
placeholder="Select a Publisher"
55+
class="w-full"
56+
/>
57+
</div>
58+
59+
<div class="mb-4">
60+
<label for="pages" class="block text-base font-medium mb-2">Pages</label>
61+
<InputText id="pages" type="text" class="w-full" />
62+
</div>
63+
64+
<div class="mb-4">
65+
<label for="year" class="block text-base font-medium mb-2">Year</label>
66+
<InputText id="year" type="text" class="w-full" />
67+
</div>
68+
</Fieldset>
69+
</template>
70+
71+
<script>
72+
export default {
73+
name: "BookDetailsView",
74+
props: {
75+
id: {
76+
type: Number,
77+
default: 0,
78+
},
79+
},
80+
};
81+
</script>

src/views/BookListView.vue

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,20 @@
1616
<template #title>{{ book.title }}</template>
1717
<template #subtitle>{{ book.allAuthors }}</template>
1818
<template #footer>
19-
<Button
20-
icon="pi pi-pencil"
21-
label="Edit"
22-
class="p-button-primary"
23-
style="width: 150px"
24-
/>
19+
<router-link
20+
:to="{ name: 'book-detail', params: { id: book.id } }"
21+
custom
22+
v-slot="{ navigate }"
23+
>
24+
<Button
25+
icon="pi pi-pencil"
26+
label="Edit"
27+
class="p-button-primary"
28+
style="width: 150px"
29+
@click="navigate"
30+
/>
31+
</router-link>
32+
2533
<Button
2634
icon="pi pi-trash"
2735
label="Delete"

0 commit comments

Comments
 (0)