diff --git a/src/assets/Angle-left.svg b/src/assets/Angle-left.svg new file mode 100644 index 0000000..18c3146 --- /dev/null +++ b/src/assets/Angle-left.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/Gallery.vue b/src/components/Gallery.vue index a46a259..63d360e 100644 --- a/src/components/Gallery.vue +++ b/src/components/Gallery.vue @@ -31,7 +31,6 @@ export default { const router = useRouter(); const navigateToArtDetail = (artworkId) => { - console.log(artworkId); router.push({ name: "ArtDetail", params: { id: artworkId } }); }; diff --git a/src/components/SearchOverlay.vue b/src/components/SearchOverlay.vue index ae4c4e9..759e534 100644 --- a/src/components/SearchOverlay.vue +++ b/src/components/SearchOverlay.vue @@ -4,16 +4,29 @@
+
Search Artworks -
-
-
@@ -56,6 +60,7 @@ import axios from "axios"; import ExhibitionBar from "./ExhibitionBar.vue"; import "vue3-carousel/dist/carousel.css"; import { Carousel, Slide, Pagination, Navigation } from "vue3-carousel"; +import { useRouter } from "vue-router"; export default { components: { @@ -68,10 +73,18 @@ export default { props: { showSearchOverlay: Boolean, }, + methods: { + closeButtonClicked() { + this.$emit("close-button-clicked"); + }, + }, + setup(props) { + const router = useRouter(); const exhibitionPage = ref(1); const loadingExhibitions = ref(true); const exhibitions = ref([]); + const searchQuery = ref(""); const fetchExhibitions = async () => { loadingExhibitions.value = true; try { @@ -117,6 +130,13 @@ export default { } }; + const navigateToSearchResults = () => { + console.log("searchQuery.value", searchQuery.value); + if (searchQuery.value.trim()) { + router.push({ name: "SearchResults", query: { q: searchQuery.value } }); + } + }; + watchEffect(() => { if (props.showSearchOverlay && exhibitions.value.length === 0) { fetchExhibitions(); @@ -127,6 +147,8 @@ export default { return { loadingExhibitions, exhibitions, + navigateToSearchResults, + searchQuery, }; }, }; diff --git a/src/router/index.ts b/src/router/index.ts index 5c85a54..f1d96ee 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,6 +1,7 @@ import { createRouter, createWebHistory } from "vue-router"; import HomeView from "../views/HomeView.vue"; -import ArtDetail from "@/views/ArtDetail.vue"; + +import SearchResults from "../views/SearchResults.vue"; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -23,6 +24,11 @@ const router = createRouter({ name: "ArtDetail", component: () => import("@/views/ArtDetail.vue"), }, + { + path: "/search", + name: "SearchResults", + component: SearchResults, + }, ], }); diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index e76986e..1897275 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -36,7 +36,10 @@ /> - + +
+ + +
+
+ + +
+ +
+
+
+
+ +
+ +
+

{{ artwork.title }}

+

Artist: {{ artwork.artist_title }}

+
+
+
+
+
+
+ + + + +