Skip to content

Commit 899d398

Browse files
committed
docs: add dark mode to example
1 parent e9e80a4 commit 899d398

File tree

7 files changed

+60
-59
lines changed

7 files changed

+60
-59
lines changed

example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"type-check": "vue-tsc --noEmit"
1111
},
1212
"dependencies": {
13-
"1llest-waveform-vue": "^1.0.3",
1413
"@vueuse/core": "^9.13.0",
1514
"nanoid": "^3.3.6",
1615
"sass": "^1.60.0",

example/pnpm-lock.yaml

Lines changed: 0 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/src/App.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { reactive } from 'vue'
33
import { useDark, useToggle } from '@vueuse/core'
44
import { nanoid } from 'nanoid'
55
import Demo from './components/Demo.vue'
6-
// import type { IllestWaveformProps } from '1llest-waveform-vue'
76
import type { IllestWaveformProps } from '../../src/types/waveform'
7+
import SunIcon from '@/components/icons/Sun.vue'
8+
import MoonIcon from '@/components/icons/Moon.vue'
89
910
type Props = {
1011
id: string
@@ -55,18 +56,32 @@ const items = reactive<Props[]>([
5556

5657
<template>
5758
<section class="flex flex-col items-center">
58-
<h1 class="flex flex-col items-center mt-2 mb-10">
59+
<h1 class="flex flex-col items-center mt-2 mb-5">
5960
<img src="/favicon.svg" class="w-32 h-32" />
6061

6162
<span class="ml-1 font-black text-[20px]">
6263
<span class="text-[24px]">1</span>LLEST-WAVEFORM-PLUGIN
6364
</span>
6465
</h1>
6566

66-
<div>
67-
<button @click="toggleDark()">theme</button>
67+
<div class="mb-6">
68+
<button class="btn" @click="toggleDark()">
69+
<SunIcon v-show="!isDark" />
70+
<MoonIcon v-show="isDark" />
71+
<div>{{ isDark ? 'dark' : 'light' }}</div>
72+
</button>
6873
</div>
6974

7075
<Demo v-for="item in items" :key="item.id" :props="item" />
7176
</section>
7277
</template>
78+
79+
<style scoped lang="scss">
80+
.btn {
81+
@apply flex items-center hover:opacity-80;
82+
83+
div {
84+
@apply ml-1 mt-1;
85+
}
86+
}
87+
</style>

example/src/components/Demo.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import { onMounted, reactive, ref, watchEffect, defineProps } from 'vue'
33
import type { Ref } from 'vue'
44
import { useDark } from '@vueuse/core'
5-
// import { IllestWaveform } from '1llest-waveform-vue'
6-
// import type { IllestWaveformProps } from '1llest-waveform-vue'
75
import IllestWaveform from '../../../src/components/IllestWaveform.vue'
86
import type { IllestWaveformProps } from '../../../src/types/waveform'
97
import '1llest-waveform-vue/dist/style.css'

example/src/components/icons/Moon.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<svg
3+
xmlns="http://www.w3.org/2000/svg"
4+
width="24"
5+
height="24"
6+
viewBox="0 0 24 24"
7+
fill="none"
8+
stroke="currentColor"
9+
stroke-width="2"
10+
stroke-linecap="round"
11+
stroke-linejoin="round"
12+
class="feather feather-moon"
13+
>
14+
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
15+
</svg>
16+
</template>

example/src/components/icons/Sun.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<svg
3+
xmlns="http://www.w3.org/2000/svg"
4+
width="24"
5+
height="24"
6+
viewBox="0 0 24 24"
7+
fill="none"
8+
stroke="currentColor"
9+
stroke-width="2"
10+
stroke-linecap="round"
11+
stroke-linejoin="round"
12+
class="feather feather-sun"
13+
>
14+
<circle cx="12" cy="12" r="5"></circle>
15+
<line x1="12" y1="1" x2="12" y2="3"></line>
16+
<line x1="12" y1="21" x2="12" y2="23"></line>
17+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
18+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
19+
<line x1="1" y1="12" x2="3" y2="12"></line>
20+
<line x1="21" y1="12" x2="23" y2="12"></line>
21+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
22+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
23+
</svg>
24+
</template>

example/src/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
html {
1010
@apply text-slate-900 bg-white;
1111
font-family: "JetBrains Mono";
12-
transition: background-color,color ease-in 0.2s
12+
transition: all ease-in 0.2s
1313
}
1414

1515
.dark {

0 commit comments

Comments
 (0)