Skip to content

Commit 8983f52

Browse files
authored
Merge pull request #22 from Nauxscript/feature/mainpage-style
feat: adjust homepage and mainpage style
2 parents a94b4a5 + 1a6bf46 commit 8983f52

File tree

8 files changed

+41
-64
lines changed

8 files changed

+41
-64
lines changed

apps/client/components/Navbar/index.vue

+18-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,29 @@ const toggleDarkMode = () => {
99
document.documentElement.classList.toggle('dark')
1010
}
1111
12+
const setDarkMode = (state = false) => {
13+
if (state) {
14+
document.documentElement.setAttribute("data-theme", "dark");
15+
document.documentElement.classList.add('dark')
16+
} else {
17+
document.documentElement.setAttribute("data-theme", "light");
18+
document.documentElement.classList.remove('dark')
19+
}
20+
}
21+
22+
onMounted(() => {
23+
const state = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
24+
setDarkMode(state)
25+
})
26+
1227
</script>
1328

1429
<template>
1530
<nav class="h-20 flex items-center justify-between">
1631
<NuxtLink to="/">
17-
<div class="logo flex">
18-
<img width="48" height="48" class="rounded-md overflow-hidden mr-2" src="/logo.png" alt="earth-worm-logo">
19-
<h1 class="w-14 text-md font-black leading-normal text-wrap text-fuchsia-400">Earth Worm</h1>
32+
<div class="logo flex items-center">
33+
<img width="48" height="48" class="rounded-md overflow-hidden mr-6" src="/logo.png" alt="earth-worm-logo">
34+
<h1 class="text-2xl leading-none font-black leading-normal text-wrap text-fuchsia-400">Earthworm</h1>
2035
</div>
2136
</NuxtLink>
2237
<div>

apps/client/components/main/CourseProgress.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>进度:{{ currentSchedule }}/{{ max }}</div>
2+
<progress class="progress w-56 m-2" value="8" max="100"></progress>
33
</template>
44

55
<script setup lang="ts">
@@ -8,7 +8,7 @@ import { useCoursesStore } from "~/store/courses";
88
const coursesStore = useCoursesStore();
99
1010
const currentSchedule = computed(() => {
11-
return coursesStore.statementIndex + 1;
11+
return coursesStore.statementIndex.value + 1;
1212
});
1313
1414
const max = computed(() => {

apps/client/components/main/Game.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<template>
2-
<div class="h-full flex justify-center items-center relative">
3-
<div>
2+
<div class="h-full w-full flex flex-col justify-center items-center">
3+
<div class="flex-1 mb-8">
44
<template v-if="mode === 'question'">
55
<Question @bingo="handleBingo"></Question>
66
</template>
77
<template v-else-if="mode === 'answer'">
88
<Answer @next-question="handleNextQuestion"></Answer>
99
</template>
1010
</div>
11-
<div class="absolute bottom-10 mb-10 w-full flex flex-col items-center">
11+
<div class="">
1212
<CourseProgress></CourseProgress>
1313
<Tips onShowAnswer="{handleShowAnswer}"></Tips>
1414
</div>

apps/client/components/main/Question.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="text-5xl text-center mb-20 mt-10">
33
<div class="text-fuchsia-500 dark:text-gray-50">
4-
{{ coursesStore.currentStatement?.chinese }}
4+
{{ coursesStore.currentStatement?.chinese || '生存还是毁灭,这是一个问题' }}
55
</div>
66
<div class="code-box">
77
<template v-for="i in lineNum" :key="i">

apps/client/components/main/TipItem.vue

-28
This file was deleted.

apps/client/components/main/Tips.vue

+9-16
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
<template>
2-
<div>
3-
<TipItem
4-
text="tab"
5-
description="show answer"
6-
keyboardKey="Tab"
7-
handler="{handleToAnswer}"
8-
></TipItem>
9-
<TipItem
10-
text="control"
11-
description="play soundmark"
12-
keyboardKey="Control"
13-
handler="{playSound}"
14-
></TipItem>
2+
<div class="flex flex-col">
3+
<div class="flex mb-2">
4+
<button className="btn btn-xs">⇥ Tab</button>
5+
<p class="ml-2">show answer</p>
6+
</div>
7+
<div class="flex">
8+
<button className="btn btn-xs">⌃ Control</button>
9+
<p class="ml-2">play soundmark</p>
10+
</div>
1511
</div>
1612
</template>
1713

1814
<script setup lang="ts">
19-
import TipItem from "./TipItem.vue";
2015
</script>
21-
22-
<style scoped></style>

apps/client/pages/Main/[id].vue

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<template>
2-
<div class="flex flex-col h-full">
3-
<!-- <Header></Header> -->
4-
<main>
5-
<Game></Game>
6-
</main>
7-
</div>
2+
<Game></Game>
83
</template>
94

105
<script setup lang="ts">

apps/client/pages/index.vue

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66
<div class="container w-full">
77
<section class="flex md:flex-row md:justify-between justify-center flex-col py-8">
88
<div class="w-1/2">
9-
<div class="flex mb-12">
10-
<img width="160" height="160" class="rounded-xl overflow-hidden mr-2" src="/logo.png" alt="earth-worm-logo">
11-
<h1 class="w-48 text-6xl font-black leading-snug text-wrap text-fuchsia-400">Earth Worm</h1>
12-
</div>
139
<div class="mb-12 leading-loose text-3xl opacity-80 items-center">
1410
<div class="">Why aren’t you good at English?</div>
15-
<div class="align-middle">It’s because you haven’t used Earthworm yet! 🤪 <i class="animate-wink inline w-1 h-8 dark:bg-white bg-slate-900 mx-2 text-2xl p-[2px]"></i></div>
11+
<div class="align-middle">It’s because you haven’t used <span class="text-fuchsia-400 font-bold">Earthworm</span> yet! 🤪 <i class="animate-wink inline w-1 h-8 dark:bg-white bg-slate-900 mx-2 text-2xl p-[2px]"></i></div>
1612
</div>
1713
<a target="_blank" href="https://github.com/cuixueshe/earthworm">
1814
<button class="indicator btn btn-outline w-48 hover:text-fuchsia-400 hover:border-fuchsia-400 hover:bg-fuchsia-100 text-fuchsia-300 border-fuchsia-300 mr-4">
@@ -51,6 +47,8 @@
5147
</template>
5248

5349
<style>
50+
51+
5452
.bg-dot {
5553
aspect-ratio: 1;
5654
position: relative;
@@ -62,6 +60,10 @@
6260
overflow: hidden;
6361
}
6462
63+
.dark .bg-dot {
64+
opacity: 1;
65+
}
66+
6567
.bg-dot::after {
6668
content: '';
6769
position: absolute;

0 commit comments

Comments
 (0)