From 6459343a127905ceceaf97942436c5b7dbe66428 Mon Sep 17 00:00:00 2001
From: Sondre Malerud <sondre_mal@hotmail.no>
Date: Wed, 26 Apr 2023 09:29:19 +0200
Subject: [PATCH] Hovedside klar (uten tips og gamification)

---
 src/components/Navbar.vue            |  4 +-
 src/views/HomeView.vue               | 93 +++++++++++++++++++++++++++-
 src/views/__tests__/HomeView.spec.js | 29 +++++++++
 3 files changed, 122 insertions(+), 4 deletions(-)
 create mode 100644 src/views/__tests__/HomeView.spec.js

diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue
index 5580393..cece845 100644
--- a/src/components/Navbar.vue
+++ b/src/components/Navbar.vue
@@ -48,7 +48,7 @@ export default {
       return `32px`;
     },
     logoSize() {
-      return '62px';
+      return '52px';
     }
   }
 }
@@ -75,7 +75,7 @@ nav {
     width: 100%;
     background-color: base.$green;
     margin:0;
-    padding:0;
+    padding:5px;
 }
 
 ul {
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index 3cd8348..afe34d4 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -1,9 +1,98 @@
-<script setup>
+<script>
+  import { useAuthStore } from "@/stores/authStore.js";
+  import { mapState } from 'pinia'
 
+  export default {
+    data() {
+      return {
+      }
+    },
+
+    computed: {
+      ...mapState(useAuthStore, ['profile'])
+    }
+
+
+  }
 </script>
 
 <template>
   <main>
-      <p>HALLO</p>
+      <div class="content">
+        <div class="welcome">
+          <img id="logo" src="../components/icons/logo.png" alt="Logo">
+          <h1>Velkommen, {{ this.profile.name }}!</h1>
+        </div>
+
+        <div class="gamification">
+          
+        </div>
+
+        <div class="tips">
+          <img id="tips-img" src="../components/icons/logo.png" alt="Logo">
+          <p id="tips-text">Her kommer tips du kanskje kan ha nytte av, trykk på meg for å gå til neste tips!</p>
+        </div>
+
+
+      </div>
   </main>
 </template>
+
+<style scoped>
+  .container {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+
+  min-width: 300px;
+  margin-top: 40px;
+}
+
+.welcome {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+  padding: 20px;
+}
+
+
+#logo {
+  width: 75px;
+  height: 75px;
+}
+
+#tips-img {
+  width: 40px;
+  height: 40px;
+  margin: auto 0;
+}
+
+
+.tips {
+  display:flex;
+  padding: 10px;
+  min-height: 75px;
+  max-height: 250px;
+  background-color: rgb(232, 232, 232);
+  margin-left: 10px;
+  margin-right: 10px;
+  
+
+}
+
+#tips-text {
+  overflow: hidden;
+  padding-left: 10px;
+}
+
+@media (min-width: 1024px) {
+  .container {
+    min-height: 100vh;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+  }
+}
+</style>
diff --git a/src/views/__tests__/HomeView.spec.js b/src/views/__tests__/HomeView.spec.js
new file mode 100644
index 0000000..caf0881
--- /dev/null
+++ b/src/views/__tests__/HomeView.spec.js
@@ -0,0 +1,29 @@
+import { describe, it, expect, vi } from 'vitest'
+import { createTestingPinia } from '@pinia/testing'
+
+import { mount } from '@vue/test-utils'
+import HomeView from '../HomeView.vue'
+
+describe('Home', () => {
+  it('renders properly', () => {
+    const wrapper = mount(HomeView, {
+        global: {
+          plugins: [createTestingPinia({
+            createSpy: vi.fn,
+          })],
+        },
+      })
+    expect(wrapper.text()).toContain('Velkommen,')
+  })
+
+  it('tips renders properly', () => {
+    const wrapper = mount(HomeView, {
+        global: {
+          plugins: [createTestingPinia({
+            createSpy: vi.fn,
+          })],
+        },
+      })
+    expect(wrapper.find('#tips-text').text()).not.toBe("");
+  })
+})
\ No newline at end of file
-- 
GitLab