diff --git a/src/components/CreateBookForm.vue b/src/components/CreateBookForm.vue index 3a86dfe..78d37c4 100644 --- a/src/components/CreateBookForm.vue +++ b/src/components/CreateBookForm.vue @@ -1,8 +1,102 @@ - - \ No newline at end of file + diff --git a/src/main.ts b/src/main.ts index 5d9e877..ef7838b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,8 +5,10 @@ import { router } from './routes' import 'vue-toast-notification/dist/theme-sugar.css' import { library } from "@fortawesome/fontawesome-svg-core"; import { faArrowRightFromBracket } from "@fortawesome/free-solid-svg-icons"; +import { faPlus } from '@fortawesome/free-solid-svg-icons' import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; library.add(faArrowRightFromBracket); +library.add(faPlus); createApp(App).use(router).use(ToastPlugin).component("font-awesome-icon", FontAwesomeIcon).mount('#app') diff --git a/src/views/Home.vue b/src/views/Home.vue index de8d107..961d6d2 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -3,9 +3,15 @@ import type { Book } from "@/models/book"; import { BookService } from "@/services/book.service"; import { onMounted, ref } from "vue"; import BookCard from "@/components/BookCard.vue"; +import CreateBookForm from "@/components/CreateBookForm.vue"; const books = ref([]); const bookService = new BookService(); +const isCreatingBookFormOpened = ref(false); + +function closeBookFormModal() { + isCreatingBookFormOpened.value = false; +} onMounted(async () => { books.value = await bookService.findBooks(); @@ -13,6 +19,7 @@ onMounted(async () => { books.value.map((book) => { book.added_at = new Date(book.added_at); }); + books.value.sort((a, b) => { if (a.updated_at > b.updated_at) { return -1; @@ -20,21 +27,52 @@ onMounted(async () => { return 1; } return 0; - }) + }); });