Skip to content

chore: dark mode added #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif&display=swap" rel="stylesheet">
<title>Starter for Vite + VueUse + TypeScript</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./src/main.ts"></script>
</body>
<head>
<meta charset="UTF-8" />
<link
href="https://fonts.googleapis.com/css2?family=Noto+Serif&display=swap"
rel="stylesheet"
/>
<link rel="shortcut icon" href="./src/logo.svg" type="image/x-icon" />
<title>Starter for Vite + VueUse + TypeScript</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./src/main.ts"></script>
</body>
</html>
77 changes: 61 additions & 16 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,44 +1,89 @@
<template>
<div id="app">
<div :id="isDark ? 'bg' : 'app'">
<img src="./logo.svg" />
<h1>Hello <a href='https://github.com/vuejs/vite' target='__blank'>Vite</a> and <a href='https://github.com/vueuse/vueuse' target='__blank'>VueUse</a>!</h1>
<h1>
Hello
<a href="https://github.com/vuejs/vite" target="__blank">Vite</a> and
<a href="https://github.com/vueuse/vueuse" target="__blank">VueUse</a>!
</h1>

<h3>Mouse: {{x}} x {{y}}</h3>
<h3 style="margin: 20px 0">Mouse: {{ x }} x {{ y }}</h3>
<h3>
Counter: {{count}}
<a @click='inc()' style='margin-right:10px'>+</a>
<a @click='dec()'>-</a>
Counter: {{ count }}
<a @click="inc()" style="margin-right: 10px">+</a>
<a @click="dec()">-</a>
</h3>
<button
class="btn"
@click="isDark = !isDark"
:class="isDark ? 'darkBtn' : 'lightBtn'"
>
{{ isDark ? "🌞" : "🌝" }}
</button>

<br><br>
<p><a href='https://github.com/vueuse/vueuse-vite-starter' target='__blank'>Source</a></p>
<p><a href='https://vueuse-vue3-example.netlify.app/' target='__blank'>Webpack Example</a></p>
<br /><br />
<p>
<a href="https://github.com/vueuse/vueuse-vite-starter" target="__blank"
>Source</a
>
</p>
<p>
<a href="https://vueuse-vue3-example.netlify.app/" target="__blank"
>Webpack Example</a
>
</p>
</div>
</template>

<script setup lang="ts">
import { useMouse, useCounter } from '@vueuse/core'
import { useMouse, useCounter, usePreferredDark } from "@vueuse/core";

const { x, y } = useMouse()
const { count, inc, dec } = useCounter()
const { x, y } = useMouse();
const isDark = usePreferredDark();
const { count, inc, dec } = useCounter();
</script>

<style scoped>
html, body, h1, h2, h3, p {
font-family: 'Noto Serif', serif;
html,
body,
h1,
h2,
h3,
p {
font-family: "Noto Serif", serif;
user-select: none;
}

#bg {
background-color: #36454f;
color: white;
height: 100vh;
}

.btn {
font-weight: bold;
cursor: pointer;
padding: 6px 14px;
border-radius: 4px;
font-size: 18px;
background: transparent;
border: none;
margin-top: 20px;
}

#app {
text-align: center;
color: rgba(0,0,0,0.4);
color: rgba(0, 0, 0, 0.4);
background-color: white;
}

img {
width: 500px;
}

a {
color: #41b883;
text-decoration: none;
cursor: pointer;
}
</style>
</style>
6 changes: 5 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}

* {
margin: 0;
padding: 0;
}