Skip to content

Commit

Permalink
feat: header, footer
Browse files Browse the repository at this point in the history
  • Loading branch information
nxhawk committed Jun 19, 2024
1 parent 79f533f commit c895cbd
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 7 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
<title>Thi thử, làm trắc nghiệm online 100% miễn phí</title>
</head>
<body>
<div id="app"></div>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"primeicons": "^7.0.0",
"vue": "^3.4.21",
"vue-router": "4"
},
Expand Down
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<script setup lang="ts">
import 'primeicons/primeicons.css'
</script>

<template>
Expand Down
7 changes: 7 additions & 0 deletions src/components/Icon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template lang="">
<i :class="'pi '+props.icon+' '+props.className"></i>
</template>

<script setup>
const props = defineProps(['icon', 'className']);
</script>
5 changes: 5 additions & 0 deletions src/components/Logo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template lang="">
<router-link :to="{ name: 'home' }" class="text-2xl font-bold text-[#67c23a]">
Baitaptracnghiem
</router-link>
</template>
22 changes: 22 additions & 0 deletions src/components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template lang="">
<div class="text-xs hidden md:flex uppercase font-semibold justify-between items-center flex-1">
<div class="flex gap-5">
<div>Đề thi THPT</div>
<div>Lớp 12</div>
<div>Lớp 11</div>
<div>Lớp 10</div>
<div>Tiếng anh</div>
<div>Đại học</div>
<div>Trắc nghiệm tính cách MBTI</div>
</div>
<Searchbar/>
</div>
<div class="flex md:hidden justify-end flex-1">
<Icon icon="pi-bars" className="text-xl"/>
</div>
</template>

<script setup>
import Searchbar from "@/components/Searchbar.vue";
import Icon from "@/components/Icon.vue";
</script>
9 changes: 9 additions & 0 deletions src/components/Searchbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template lang="">
<button class="text-gray-400 flex items-center gap-1 outline-none text-[0.6rem]">
<Icon icon="pi-search" />
<span class="uppercase">tìm kiếm</span>
</button>
</template>
<script setup>
import Icon from "@/components/Icon.vue";
</script>
14 changes: 14 additions & 0 deletions src/layout/DefaultLayout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<template lang="">
<div>
<Header/>
<div class="pt-12 min-h-screen">
<router-view/>
</div>
<Footer/>
</div>
</template>

<script setup lang="ts">
import Header from "@/layout/Header.vue";

Check failure on line 12 in src/layout/DefaultLayout.vue

View workflow job for this annotation

GitHub Actions / deploy

'Header' is declared but its value is never read.
import Footer from "@/layout/Footer.vue";

Check failure on line 13 in src/layout/DefaultLayout.vue

View workflow job for this annotation

GitHub Actions / deploy

'Footer' is declared but its value is never read.
</script>
8 changes: 8 additions & 0 deletions src/layout/Footer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template lang="">
<div class="h-16 bg-slate-100 flex items-center justify-center">
Footer
</div>
</template>
<script setup>
</script>
12 changes: 12 additions & 0 deletions src/layout/Header.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script setup>
import Logo from "@/components/Logo.vue";
import Navbar from "@/components/Navbar.vue";
</script>

<template lang="">
<div class="fixed w-full top-0 left-0 bg-white px-2 md:px-5 h-12 flex items-center shadow-md gap-4">
<Logo />
<Navbar />
</div>
</template>

19 changes: 14 additions & 5 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import { createRouter, createWebHistory } from 'vue-router'
import NotFoundPage from "@/views/NoutFoundPage.vue";
import HomePage from "@/views/HomePage.vue";

const routes = [
{
path:"/",
name: "home",
component: HomePage,
component: () => import('@/layout/DefaultLayout.vue'),
children: [
{
path: "",
name: "home",
component: () => import("@/views/HomePage.vue"),
},
{
path: "/danh-sach-bai-tap/:classId",
name: "course",
component: () => import("@/views/ExercisePage.vue"),
},
]
},
{
path:"/:pathMatch(.*)*",
name: "notfound",
component: NotFoundPage,
component: () => import("@/views/NoutFoundPage.vue"),
}
]

Expand Down
8 changes: 8 additions & 0 deletions src/views/ExercisePage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template lang="">
<div>
Exercise
</div>
</template>
<script setup lang="ts">
</script>
2 changes: 1 addition & 1 deletion src/views/HomePage.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template lang="">

<div>
Home page
</div>
</template>
<script setup lang="ts">
</script>
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1581,6 +1581,11 @@ postcss@^8.4.23, postcss@^8.4.38:
picocolors "^1.0.0"
source-map-js "^1.2.0"

primeicons@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/primeicons/-/primeicons-7.0.0.tgz#6b25c3fdcb29bb745a3035bdc1ed5902f4a419cf"
integrity sha512-jK3Et9UzwzTsd6tzl2RmwrVY/b8raJ3QZLzoDACj+oTJ0oX7L9Hy+XnVwgo4QVKlKpnP/Ur13SXV/pVh4LzaDw==

punycode@^2.1.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
Expand Down

0 comments on commit c895cbd

Please sign in to comment.