diff --git a/Frontend/src/App.vue b/Frontend/src/App.vue index 59bba9e94a77f93c13c9ca367908fadb3eb514ac..beee6f3ecbaf0c732ffd96670e55438ce5d86238 100644 --- a/Frontend/src/App.vue +++ b/Frontend/src/App.vue @@ -1,14 +1,15 @@ <template> <header> <div class="wrapper"> - <img src="@/assets/images/logo.svg" alt="My Logo" class="logo"> <nav> - <RouterLink to="/">Home</RouterLink> - <RouterLink to="/login">Login</RouterLink> + <router-link to="/"><img src="@/assets/images/logo.svg" alt="My Logo" class="logo"></router-link> + <RouterLink class="test" to="/login">Login</RouterLink> </nav> </div> </header> - <RouterView /> + <main> + <RouterView /> + </main> <v-footer> <div class="wrapper"> <p>Copyright © {{ new Date().getFullYear() }} Handel uten Hemninger</p> @@ -27,22 +28,32 @@ const logo = logoPath <style scoped> -header { - line-height: 1.5; - max-height: 100vh; + + +main { + padding-top: 100px; + min-height: calc(100vh - 215px); } .logo { display: block; margin: 0 2rem 0 0; - height: 150px; + height: 75px; width: auto; } nav { display: flex; align-items: center; - justify-content: center; + justify-content: flex-start;; + position: fixed; + height: 100px; + background-color: #fff; + top: 0; + left: 0; + right: 0; + z-index: 9999; + border-bottom: 1px solid #0718c4; } nav a { @@ -58,12 +69,18 @@ nav a { transition: all 0.2s ease; } -nav a:hover, -nav a.router-link-exact-active { +nav a.test:hover, +nav a.test.router-link-exact-active { background-color: #0718c4; color: #fff; } +.logo:hover{ + border: 4px solid #0718c4; + border-radius: 1rem; +} + + v-footer { background-color: #0718c4; color: white; @@ -71,6 +88,8 @@ v-footer { display: flex; align-items: center; margin-top: auto; + bottom: 0; + } v-footer .wrapper { @@ -84,6 +103,7 @@ v-footer { v-footer p { margin: 0; font-size: 1.2rem; + } @media (min-width: 1024px) { diff --git a/Frontend/src/components/Listing.vue b/Frontend/src/components/Listing.vue index afad8d6129868de8f774a0e2504e3199d8a2d235..78bc0407b45234e7e46736e09aad5fbcfe3c58a5 100644 --- a/Frontend/src/components/Listing.vue +++ b/Frontend/src/components/Listing.vue @@ -3,7 +3,8 @@ <img v-bind:src="image" alt=""> <h2>{{ name }}</h2> <span>{{ price + " NOK" }}</span> - <img v-bind:src="favoriteIcon" @click.stop="toggleFavorite" alt="Add to favorites" class="favorite-icon"> </div> + <img v-bind:src="favoriteIcon" @click.stop="toggleFavorite" alt="Add to favorites" class="favorite-icon"> + </div> </template> <script lang="ts"> @@ -32,7 +33,7 @@ } }, methods: { - handleClick() {router.push('/listing/' + this.id) // navigate to the other view + handleClick() {router.push('/listing/' + this.id) console.log('clicked') }, toggleFavorite() { @@ -77,14 +78,14 @@ h2 { height: 70px; display: -webkit-box; - -webkit-line-clamp: 3; /* Number of lines to show */ + -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; } .shopping-listing:hover { - box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3); + box-shadow: 0px 0px 10px #0718c4; } .shopping-listing img { diff --git a/Frontend/src/views/ListingView.vue b/Frontend/src/views/ListingView.vue index 15bf6c43476d1f90653628abf1a9d4b8e6ab9404..6e85da40b3ae466c956121324054df1b15574fcb 100644 --- a/Frontend/src/views/ListingView.vue +++ b/Frontend/src/views/ListingView.vue @@ -1,19 +1,24 @@ <template> <div class="listing-view"> <div class="listing-image"> - <img v-bind:src="image" alt=""> + <img v-bind:src="image" alt="" /> </div> <div class="listing-details"> <h2>{{ name }}</h2> - <span>{{ price }}</span> + <span>{{ price + ' NOK' }}</span> + <div class="listing-actions"> + <button @click="$emit('add-to-cart', { name, price })">Add to Cart</button> + <img v-bind:src="favoriteIcon" @click.stop="toggleFavorite" alt="Add to favorites" class="favorite-icon"/> + </div> <p>{{ description }}</p> - <button @click="$emit('add-to-cart', { name, price })">Add to Cart</button> </div> </div> </template> <script lang="ts"> import axios from 'axios'; + import heartFilled from '@/assets/images/heartFilled.svg' + import heartOutline from '@/assets/images/heartOutline.svg' export default { name: 'ListingView', @@ -23,7 +28,17 @@ name: '', price: '', image: '', - description: '' + description: '', + isFavorite: false, + favoriteIcon: heartOutline, + favoriteIconFilled: heartFilled + } + }, + methods: { + toggleFavorite() { + this.isFavorite = !this.isFavorite; + this.favoriteIcon = this.isFavorite ? this.favoriteIconFilled : heartOutline; + console.log(this.isFavorite) } }, created() { @@ -47,56 +62,77 @@ </script> <style scoped> - .listing-view { - display: flex; - flex-direction: row; - align-items: flex-start; - border: 1px solid #ccc; - padding: 1rem; - margin-bottom: 1rem; - } - - .listing-image { - width: 50%; - } - - .listing-image img { - max-width: 100%; - } - - .listing-details { - width: 50%; - padding-left: 1rem; - } - - .listing-details h2 { - font-size: 1.5rem; - margin: 0.5rem 0; - } - - .listing-details span { - font-size: 1.3rem; - font-weight: bold; - margin: 0.5rem 0; - } - - .listing-details p { - font-size: 1.1rem; - line-height: 1.6; - margin-bottom: 1rem; - } - - .listing-details button { - background-color: #4CAF50; - border: none; - color: white; - padding: 0.5rem 1rem; - text-align: center; - text-decoration: none; - display: inline-block; - font-size: 1rem; - border-radius: 0.25rem; - cursor: pointer; - } + .listing-view { + display: flex; + flex-direction: column; + align-items: center; + padding: 1rem; + margin-bottom: 1rem; + max-width: 1524px; + margin: 0 auto; +} + +.listing-image { + width: 100%; + display: flex; + justify-content: center; +} +.listing-image img { + max-width: 100%; +} + +.listing-details { + width: 100%; + padding-top: 1rem; + text-align: center; +} + +.listing-details h2 { + font-size: 1.5rem; + margin: 0.5rem 0; +} + +.listing-details span { + display: block; + font-size: 1.3rem; + font-weight: bold; + margin: 0.5rem 0; +} + +.listing-details p { + font-size: 1.1rem; + line-height: 1.6; + margin-bottom: 1rem; + max-width: 700px; + margin-left: auto; + margin-right: auto; +} + +.listing-details button { + background-color: #0718c4; + border: none; + color: white; + padding: 0.5rem 1rem; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 1rem; + border-radius: 0.25rem; + cursor: pointer; + margin-right: 1rem; +} + +.listing-actions { + display: flex; + justify-content: center; + align-items: center; + margin-bottom: 1rem; +} + +.favorite-icon { + width: 30px; + height: 30px; + margin-left: 1rem; +} </style> \ No newline at end of file