Skip to content

Commit 370dcb1

Browse files
committed
feat: improve playground style
1 parent a15bb9c commit 370dcb1

File tree

12 files changed

+115
-50
lines changed

12 files changed

+115
-50
lines changed

apps/playground/assets/logo.png

155 KB
Loading
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
@import '@ant-design-vue/tailwind-config';
2+
@import '@ant-design-vue/tailwind-config/themes';
23
@source '../index.html';
34
@source '../src/**/*.{vue,ts}';
5+
46
* {
57
scrollbar-width: thin;
68
scrollbar-color: var(--color-base-300) transparent;
79
}
10+
811
*:focus-visible {
912
outline: none;
1013
}
11-
12-
.shiki.github-dark,
13-
.dark-scrollbar {
14-
scrollbar-color: rgba(121, 121, 121, 0.4) transparent;
15-
}

apps/playground/src/App.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
<template>
2-
<button @click="toggleTheme" class="fixed top-2 right-2">toggle {{ appearance }}</button>
2+
<the-header />
33
<a-theme :appearance="appearance">
44
<RouterView />
55
</a-theme>
66
</template>
77
<script setup lang="ts">
8-
import { ref } from 'vue'
9-
10-
const appearance = ref('light')
11-
12-
const toggleTheme = () => {
13-
appearance.value = appearance.value === 'light' ? 'dark' : 'light'
14-
}
8+
import TheHeader from '@/components/TheHeader.vue';
9+
import { appearance } from '@/composables/appearance';
1510
</script>

apps/playground/src/components/BasicLayout.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<div class="flex h-screen" :class="pageClass">
2+
<div class="flex h-[calc(100vh-72px)] bg-base-100/90" :class="pageClass">
33
<TheNavbar v-if="!hideNavbar" :items="navs"></TheNavbar>
4-
<div class="flex-1 justify-center px-4 py-16" :class="contentClass">
4+
<div class="flex-1 justify-center p-4 overflow-scroll" :class="contentClass">
55
<RouterView></RouterView>
66
</div>
77
</div>

apps/playground/src/components/TheBreadcrumbs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<li class="flex items-center">
66
<template v-if="i > 0">
77
<span
8-
class="ml-2 mr-3 block size-1.5 rotate-45 transform border-r-[1px] border-t-[1px] border-base-content/70 bg-transparent"
8+
class="ml-2 mr-3 block size-1.5 rotate-45 transform border-r border-base-content/70 bg-transparent"
99
></span>
1010
</template>
1111
<template v-if="item.path !== route.path">
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<script setup lang="ts">
2+
import logoSrc from '~/logo.png?inline';
3+
import { appearance } from '@/composables/appearance';
4+
import { MoonIcon, SunIcon } from "@heroicons/vue/20/solid"
5+
6+
const toggleTheme = () => {
7+
appearance.value = appearance.value === 'light' ? 'dark' : 'light'
8+
}
9+
</script>
10+
11+
<template>
12+
<header class="px-8 py-2 border-b flex justify-between items-center bg-base-100/90 text-base-content border-base-content/10 h-18">
13+
<div class="flex items-center">
14+
<img :src="logoSrc" alt="Logo" class="h-8 inline-block mr-3" />
15+
<h3 class="font-semibold text-xl">Playground</h3>
16+
</div>
17+
18+
<div>
19+
<button @click="toggleTheme" class="cursor-pointer p-2 rounded hover:bg-base-content/10 transition">
20+
<MoonIcon class="size-4" v-if="appearance === 'light'" />
21+
<SunIcon class="size-4" v-else />
22+
</button>
23+
</div>
24+
</header>
25+
</template>

apps/playground/src/components/TheNavbar.vue

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
<template>
2-
<div class="bg-base-100/90 text-base-content border-base-content/10 border-r">
3-
<div class="flex min-h-16 w-full items-center p-2">
2+
<div class="text-base-content border-base-content/10 border-r">
3+
<div class="flex min-h-16 w-full p-2 pr-0 h-[calc(100vh-72px)] overflow-scroll">
44
<div class="justify-start">
55
<div class="group relative inline-block">
66
<ul
77
tabindex="0"
8-
class="bg-base-100 z-[1] mt-3 flex w-52 origin-top scale-95 flex-col flex-wrap rounded-lg p-2 text-sm capitalize"
8+
class="z-1 mt-3 flex w-54 origin-top scale-95 flex-col rounded-lg p-2 text-sm capitalize"
99
>
10-
<li v-for="item in items" :key="item.name">
10+
<li v-for="item in items" :key="item.name" class="mb-2">
1111
<RouterLink
1212
:aria-disabled="item.path === route.path"
1313
:to="item.path"
14-
@click.stop="$event.currentTarget.blur()"
15-
class="hover:bg-base-content/10 flex cursor-pointer flex-col rounded-lg px-3 py-2 transition duration-200"
14+
class="hover:bg-base-content/10 flex cursor-pointer flex-col rounded-lg px-3 py-2 transition duration-200 font-semibold text-lg"
1615
>
17-
{{ item.name }}
16+
{{ item.name }}
1817
</RouterLink>
1918
<ul v-if="item.children">
2019
<li v-for="child in item.children" :key="child.name">
2120
<RouterLink
2221
:to="child.path"
23-
@click.stop="$event.currentTarget.blur()"
24-
class="hover:bg-base-content/10 flex cursor-pointer flex-col rounded-lg px-3 py-2 text-xs opacity-80 transition duration-200"
22+
class="hover:bg-base-content/10 flex cursor-pointer flex-col rounded-lg px-3 py-2 text-xs opacity-80 transition duration-200 text-[16px]"
2523
>
2624
{{ child.name }}
2725
</RouterLink>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { ref } from "vue";
2+
3+
export const appearance = ref<"light" | "dark">("light");

apps/playground/src/pages/affix/basic.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<script lang="ts" setup>
1414
import { ref } from 'vue'
15-
const top = ref<number>(10)
15+
const top = ref<number>(100)
1616
const bottom = ref<number>(10)
1717
const onChange = (lastAffix: boolean) => {
1818
console.log('onChange', lastAffix)

packages-config/tailwind-config/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
".": {
77
"default": "./tailwind.css"
88
},
9-
"./themes/*": {
10-
"default": "./themes/*.css"
9+
"./themes": {
10+
"default": "./themes.css"
1111
}
1212
},
1313
"devDependencies": {

0 commit comments

Comments
 (0)