valaxy-theme-press 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/assets/images/none.jpg +0 -0
- package/components/PressAlgoliaSearch.vue +208 -0
- package/components/PressArticle.vue +12 -6
- package/components/PressAside.vue +24 -17
- package/components/PressBackdrop.vue +1 -1
- package/components/PressButton.vue +5 -1
- package/components/PressCategories.vue +8 -3
- package/components/PressCategory.vue +13 -11
- package/components/PressDocFooterLastUpdated.vue +2 -1
- package/components/PressFeatures.vue +1 -1
- package/components/PressFooter.vue +1 -1
- package/components/PressHome.vue +1 -1
- package/components/PressHomeFeatures.vue +1 -0
- package/components/PressHomeHero.vue +12 -10
- package/components/PressLocalNav.vue +9 -9
- package/components/PressNav.vue +30 -5
- package/components/PressNavBar.vue +94 -0
- package/components/PressNavBarAppearance.vue +5 -0
- package/components/PressNavBarHamburger.vue +79 -0
- package/components/PressNavBarMenu.vue +14 -0
- package/components/PressNavBarSearch.vue +40 -0
- package/components/PressNavBarSocialLinks.vue +26 -0
- package/components/PressNavBarTranslations.vue +5 -0
- package/components/{nav/PressNavItemGroup.vue → PressNavItemGroup.vue} +8 -5
- package/components/{nav/PressNavItemLink.vue → PressNavItemLink.vue} +2 -1
- package/components/PressNavScreen.vue +95 -0
- package/components/PressNavScreenAppearance.vue +32 -0
- package/components/PressNavScreenMenu.vue +22 -0
- package/components/PressNavScreenMenuGroup.vue +115 -0
- package/components/PressNavScreenMenuGroupLink.vue +32 -0
- package/components/PressNavScreenMenuGroupSection.vue +37 -0
- package/components/PressNavScreenMenuLink.vue +33 -0
- package/components/PressNavScreenSocialLinks.vue +13 -0
- package/components/PressNavScreenTranslations.vue +7 -0
- package/components/PressOutline.vue +3 -4
- package/components/PressPostList.vue +6 -6
- package/components/PressSidebar.vue +10 -9
- package/components/PressSocialLink.vue +40 -0
- package/components/PressSocialLinks.vue +26 -0
- package/components/ValaxyMain.vue +46 -33
- package/composables/config.ts +0 -1
- package/composables/nav.ts +37 -0
- package/config/index.ts +5 -2
- package/layouts/layout.vue +2 -3
- package/locales/en.yml +4 -0
- package/locales/zh-CN.yml +4 -0
- package/package.json +3 -13
- package/pages/{[..all].vue → [...all].vue} +1 -0
- package/setup/main.ts +16 -3
- package/styles/css-vars.scss +11 -6
- package/styles/markdown.scss +9 -12
- package/tsconfig.json +11 -11
- package/types/index.d.ts +20 -5
- package/utils/index.ts +8 -0
- package/components/DocsBoard.vue +0 -24
- package/components/nav/PressNavBar.vue +0 -111
- /package/components/{nav/PressSwitchAppearance.vue → PressSwitchAppearance.vue} +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useSidebar, useSiteConfig } from 'valaxy'
|
|
3
|
+
import { useThemeConfig } from '../composables'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
isScreenOpen?: boolean
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
defineEmits<{
|
|
10
|
+
(e: 'toggleScreen'): void
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const { hasSidebar } = useSidebar()
|
|
14
|
+
|
|
15
|
+
const siteConfig = useSiteConfig()
|
|
16
|
+
const themeConfig = useThemeConfig()
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="pr-navbar flex justify-between items-center pl-4 pr-2" :class="{ 'has-sidebar': hasSidebar }">
|
|
21
|
+
<router-link class="text-xl flex justify-center items-center" to="/" :aria-label="siteConfig.title">
|
|
22
|
+
<img v-if="themeConfig.logo" class="logo" :src="themeConfig.logo" alt="LOGO">
|
|
23
|
+
<span class="inline-flex">{{ siteConfig.title }}</span>
|
|
24
|
+
</router-link>
|
|
25
|
+
<div class="self-stretch flex justify-center items-center text-sm leading-5">
|
|
26
|
+
<PressNavBarSearch p="x-2" />
|
|
27
|
+
<PressNavBarMenu p="x-2" />
|
|
28
|
+
<PressNavBarTranslations p="x-2" />
|
|
29
|
+
<PressNavBarAppearance p="x-2" />
|
|
30
|
+
<PressNavBarSocialLinks p="x-2" />
|
|
31
|
+
|
|
32
|
+
<PressNavBarHamburger :active="isScreenOpen" @click="$emit('toggleScreen')" />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<style lang="scss">
|
|
38
|
+
@use 'valaxy/client/styles/mixins/index.scss' as *;
|
|
39
|
+
|
|
40
|
+
:root {
|
|
41
|
+
--pr-navbar-c-bg: rgba(255, 255, 255, 0.8);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.logo {
|
|
45
|
+
width: 32px;
|
|
46
|
+
height: 32px;
|
|
47
|
+
margin-right: 8px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.dark {
|
|
51
|
+
--pr-navbar-c-bg: rgba(24, 24, 24, 0.3);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.pr-navbar {
|
|
55
|
+
position: relative;
|
|
56
|
+
border-bottom: 1px solid var(--pr-c-divider-light);
|
|
57
|
+
padding: 0 8px 0 24px;
|
|
58
|
+
height: var(--pr-nav-height);
|
|
59
|
+
transition: border-color 0.5s;
|
|
60
|
+
background-color: var(--pr-navbar-c-bg);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include screen('md') {
|
|
64
|
+
.pr-navbar {
|
|
65
|
+
padding: 0 32px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@include screen('md') {
|
|
70
|
+
.pr-navbar.has-sidebar .content {
|
|
71
|
+
margin-right: -32px;
|
|
72
|
+
padding-right: 32px;
|
|
73
|
+
-webkit-backdrop-filter: saturate(50%) blur(8px);
|
|
74
|
+
backdrop-filter: saturate(50%) blur(8px);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@supports not (backdrop-filter: saturate(50%) blur(8px)) {
|
|
78
|
+
.pr-navbar.has-sidebar .content {
|
|
79
|
+
background: rgba(255, 255, 255, 0.95);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.dark .pr-navbar.has-sidebar .content {
|
|
83
|
+
background: rgba(36, 36, 36, 0.95);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.container {
|
|
89
|
+
display: flex;
|
|
90
|
+
justify-content: space-between;
|
|
91
|
+
margin: 0 auto;
|
|
92
|
+
max-width: calc(var(--pr-layout-max-width) - 64px);
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
defineProps<{
|
|
3
|
+
active: boolean
|
|
4
|
+
}>()
|
|
5
|
+
|
|
6
|
+
defineEmits<{
|
|
7
|
+
(e: 'click'): void
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<button
|
|
13
|
+
type="button"
|
|
14
|
+
class="pr-NavBarHamburger"
|
|
15
|
+
:class="{ active }"
|
|
16
|
+
aria-label="mobile navigation"
|
|
17
|
+
:aria-expanded="active"
|
|
18
|
+
aria-controls="pr-NavScreen"
|
|
19
|
+
@click="$emit('click')"
|
|
20
|
+
>
|
|
21
|
+
<span class="container">
|
|
22
|
+
<span class="top" />
|
|
23
|
+
<span class="middle" />
|
|
24
|
+
<span class="bottom" />
|
|
25
|
+
</span>
|
|
26
|
+
</button>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<style scoped>
|
|
30
|
+
.pr-NavBarHamburger {
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
align-items: center;
|
|
34
|
+
width: 48px;
|
|
35
|
+
height: var(--pr-nav-height);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (min-width: 768px) {
|
|
39
|
+
.pr-NavBarHamburger {
|
|
40
|
+
display: none;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.container {
|
|
45
|
+
position: relative;
|
|
46
|
+
width: 16px;
|
|
47
|
+
height: 14px;
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.pr-NavBarHamburger:hover .top { top: 0; left: 0; transform: translateX(4px); }
|
|
52
|
+
.pr-NavBarHamburger:hover .middle { top: 6px; left: 0; transform: translateX(0); }
|
|
53
|
+
.pr-NavBarHamburger:hover .bottom { top: 12px; left: 0; transform: translateX(8px); }
|
|
54
|
+
|
|
55
|
+
.pr-NavBarHamburger.active .top { top: 6px; transform: translateX(0) rotate(225deg); }
|
|
56
|
+
.pr-NavBarHamburger.active .middle { top: 6px; transform: translateX(16px); }
|
|
57
|
+
.pr-NavBarHamburger.active .bottom { top: 6px; transform: translateX(0) rotate(135deg); }
|
|
58
|
+
|
|
59
|
+
.pr-NavBarHamburger.active:hover .top,
|
|
60
|
+
.pr-NavBarHamburger.active:hover .middle,
|
|
61
|
+
.pr-NavBarHamburger.active:hover .bottom {
|
|
62
|
+
background-color: var(--pr-c-text-2);
|
|
63
|
+
transition: top .25s, background-color .25s, transform .25s;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.top,
|
|
67
|
+
.middle,
|
|
68
|
+
.bottom {
|
|
69
|
+
position: absolute;
|
|
70
|
+
width: 16px;
|
|
71
|
+
height: 2px;
|
|
72
|
+
background-color: var(--pr-c-text-1);
|
|
73
|
+
transition: top .25s, background-color .5s, transform .25s;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.top { top: 0; left: 0; transform: translateX(0); }
|
|
77
|
+
.middle { top: 6px; left: 0; transform: translateX(8px); }
|
|
78
|
+
.bottom { top: 12px; left: 0; transform: translateX(4px); }
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useThemeConfig } from '../composables'
|
|
3
|
+
|
|
4
|
+
const themeConfig = useThemeConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="flex lt-md:hidden">
|
|
9
|
+
<template v-for="item in themeConfig.nav" :key="item.text">
|
|
10
|
+
<PressNavItemLink v-if="'link' in item" class="px-2" :item="item" />
|
|
11
|
+
<PressNavItemGroup v-else class="px-2" :item="item" />
|
|
12
|
+
</template>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useSiteConfig } from 'valaxy'
|
|
3
|
+
import { computed, defineAsyncComponent } from 'vue'
|
|
4
|
+
|
|
5
|
+
// ref vitepress search box
|
|
6
|
+
const siteConfig = useSiteConfig()
|
|
7
|
+
const isAlgolia = computed(() => siteConfig.value.search.type === 'algolia')
|
|
8
|
+
|
|
9
|
+
const PressAlgoliaSearch = isAlgolia.value
|
|
10
|
+
? defineAsyncComponent(() => import('./PressAlgoliaSearch.vue'))
|
|
11
|
+
: () => null
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div v-if="siteConfig.search.enable" class="VPNavBarSearch">
|
|
16
|
+
<ClientOnly>
|
|
17
|
+
<PressAlgoliaSearch v-if="isAlgolia" />
|
|
18
|
+
</ClientOnly>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
.VPNavBarSearch {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@media (min-width: 768px) {
|
|
29
|
+
.VPNavBarSearch {
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
padding-left: 24px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@media (min-width: 960px) {
|
|
36
|
+
.VPNavBarSearch {
|
|
37
|
+
padding-left: 32px;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useThemeConfig } from '../composables'
|
|
3
|
+
|
|
4
|
+
const themeConfig = useThemeConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<PressSocialLinks
|
|
9
|
+
v-if="themeConfig.socialLinks"
|
|
10
|
+
class="pr-nav-bar-social-links"
|
|
11
|
+
:links="themeConfig.socialLinks"
|
|
12
|
+
/>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<style scoped>
|
|
16
|
+
.pr-nav-bar-social-links {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media (min-width: 1280px) {
|
|
21
|
+
.pr-nav-bar-social-links {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { ref } from 'vue'
|
|
3
|
-
import
|
|
3
|
+
import { useI18n } from 'vue-i18n'
|
|
4
|
+
import type { NavItemGroup } from '../types'
|
|
5
|
+
|
|
4
6
|
defineProps<{
|
|
5
7
|
item: NavItemGroup
|
|
6
8
|
}>()
|
|
7
9
|
|
|
8
10
|
const open = ref(false)
|
|
11
|
+
|
|
12
|
+
const { t } = useI18n()
|
|
9
13
|
</script>
|
|
10
14
|
|
|
11
15
|
<template>
|
|
12
16
|
<div
|
|
13
|
-
ref="el"
|
|
14
17
|
class="flex self-stretch relative group"
|
|
15
18
|
:aria-expanded="open"
|
|
16
19
|
aria-haspopup="true"
|
|
@@ -19,18 +22,18 @@ const open = ref(false)
|
|
|
19
22
|
>
|
|
20
23
|
<button
|
|
21
24
|
type="button"
|
|
22
|
-
class="button flex items-center"
|
|
25
|
+
class="button flex items-center bg-transparent"
|
|
23
26
|
@click="open = !open"
|
|
24
27
|
>
|
|
25
28
|
<span class="text">
|
|
26
|
-
{{ item.text }}
|
|
29
|
+
{{ t(item.text) }}
|
|
27
30
|
</span>
|
|
28
31
|
<div i-ri-arrow-drop-down-line />
|
|
29
32
|
</button>
|
|
30
33
|
|
|
31
34
|
<div class="menu grow" flex="~ col" items="start">
|
|
32
35
|
<AppLink v-for="itemLink in item.items" :key="itemLink.text" class="menu-item" p="x-3" :to="itemLink.link">
|
|
33
|
-
{{ itemLink.text }}
|
|
36
|
+
{{ t(itemLink.text) }}
|
|
34
37
|
</AppLink>
|
|
35
38
|
</div>
|
|
36
39
|
</div>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { useBodyScrollLock } from 'valaxy'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
open: boolean
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const screen = ref<HTMLElement>()
|
|
10
|
+
const { lockBodyScroll, unlockBodyScroll } = useBodyScrollLock(screen)
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<transition
|
|
15
|
+
name="fade"
|
|
16
|
+
@enter="lockBodyScroll"
|
|
17
|
+
@after-leave="unlockBodyScroll"
|
|
18
|
+
>
|
|
19
|
+
<div v-if="open" ref="screen" class="pr-NavScreen">
|
|
20
|
+
<div class="container" flex="~ col">
|
|
21
|
+
<slot name="nav-screen-content-before" />
|
|
22
|
+
<PressNavScreenMenu class="menu" />
|
|
23
|
+
<PressNavScreenTranslations class="translations" />
|
|
24
|
+
<PressNavScreenAppearance class="appearance" />
|
|
25
|
+
<PressNavScreenSocialLinks class="social-links" />
|
|
26
|
+
|
|
27
|
+
<slot name="nav-screen-content-after" />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</transition>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<style scoped>
|
|
34
|
+
.pr-NavScreen {
|
|
35
|
+
position: fixed;
|
|
36
|
+
top: calc(var(--pr-nav-height) + var(--pr-layout-top-height, 0px) + 1px);
|
|
37
|
+
/*rtl:ignore*/
|
|
38
|
+
right: 0;
|
|
39
|
+
bottom: 0;
|
|
40
|
+
/*rtl:ignore*/
|
|
41
|
+
left: 0;
|
|
42
|
+
padding: 0 32px;
|
|
43
|
+
width: 100%;
|
|
44
|
+
background-color: var(--pr-nav-screen-bg-color);
|
|
45
|
+
overflow-y: auto;
|
|
46
|
+
transition: background-color 0.5s;
|
|
47
|
+
pointer-events: auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.pr-NavScreen.fade-enter-active,
|
|
51
|
+
.pr-NavScreen.fade-leave-active {
|
|
52
|
+
transition: opacity 0.25s;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.pr-NavScreen.fade-enter-active .container,
|
|
56
|
+
.pr-NavScreen.fade-leave-active .container {
|
|
57
|
+
transition: transform 0.25s ease;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.pr-NavScreen.fade-enter-from,
|
|
61
|
+
.pr-NavScreen.fade-leave-to {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.pr-NavScreen.fade-enter-from .container,
|
|
66
|
+
.pr-NavScreen.fade-leave-to .container {
|
|
67
|
+
transform: translateY(-8px);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (min-width: 768px) {
|
|
71
|
+
.pr-NavScreen {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.container {
|
|
77
|
+
margin: 0 auto;
|
|
78
|
+
padding: 24px 0 96px;
|
|
79
|
+
max-width: 288px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.menu + .translations,
|
|
83
|
+
.menu + .appearance,
|
|
84
|
+
.translations + .appearance {
|
|
85
|
+
margin-top: 24px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.menu + .social-links {
|
|
89
|
+
margin-top: 16px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.appearance + .social-links {
|
|
93
|
+
margin-top: 16px;
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useThemeConfig } from '../composables/config'
|
|
3
|
+
|
|
4
|
+
const themeConfig = useThemeConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<div class="pr-nav-screen-appearance" flex="~ 1">
|
|
9
|
+
<p class="text">
|
|
10
|
+
{{ themeConfig.darkModeSwitchLabel || 'Appearance' }}
|
|
11
|
+
</p>
|
|
12
|
+
<PressSwitchAppearance />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style scoped>
|
|
17
|
+
.pr-nav-screen-appearance {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
align-items: center;
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
padding: 12px 14px 12px 16px;
|
|
23
|
+
background-color: var(--va-c-bg-soft);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.text {
|
|
27
|
+
line-height: 24px;
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
color: var(--va-c-text-2);
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { useThemeConfig } from '../composables'
|
|
3
|
+
|
|
4
|
+
const themeConfig = useThemeConfig()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<nav v-if="themeConfig.nav" class="pr-nav-screen-menu">
|
|
9
|
+
<template v-for="item in themeConfig.nav" :key="item.text">
|
|
10
|
+
<PressNavScreenMenuLink
|
|
11
|
+
v-if="'link' in item"
|
|
12
|
+
:text="item.text"
|
|
13
|
+
:link="item.link"
|
|
14
|
+
/>
|
|
15
|
+
<PressNavScreenMenuGroup
|
|
16
|
+
v-else
|
|
17
|
+
:text="item.text || ''"
|
|
18
|
+
:items="item.items"
|
|
19
|
+
/>
|
|
20
|
+
</template>
|
|
21
|
+
</nav>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps<{
|
|
5
|
+
text: string
|
|
6
|
+
items: any[]
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const isOpen = ref(false)
|
|
10
|
+
|
|
11
|
+
const groupId = computed(() =>
|
|
12
|
+
`NavScreenGroup-${props.text.replace(' ', '-').toLowerCase()}`,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
function toggle() {
|
|
16
|
+
isOpen.value = !isOpen.value
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div class="pr-nav-screen-menu-group" :class="{ open: isOpen }">
|
|
22
|
+
<button
|
|
23
|
+
class="button"
|
|
24
|
+
:aria-controls="groupId"
|
|
25
|
+
:aria-expanded="isOpen"
|
|
26
|
+
@click="toggle"
|
|
27
|
+
>
|
|
28
|
+
<span class="button-text">{{ text }}</span>
|
|
29
|
+
<div i-ri-add-line class="button-icon" />
|
|
30
|
+
</button>
|
|
31
|
+
|
|
32
|
+
<div :id="groupId" class="items">
|
|
33
|
+
<template v-for="item in items" :key="item.text">
|
|
34
|
+
<div v-if="'link' in item" :key="item.text" class="item">
|
|
35
|
+
<PressNavScreenMenuGroupLink
|
|
36
|
+
:text="item.text"
|
|
37
|
+
:link="item.link"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div v-else class="group">
|
|
42
|
+
<PressNavScreenMenuGroupSection
|
|
43
|
+
:text="item.text"
|
|
44
|
+
:items="item.items"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.pr-nav-screen-menu-group {
|
|
54
|
+
border-bottom: 1px solid var(--pr-c-divider);
|
|
55
|
+
height: 48px;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
transition: border-color 0.5s;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.pr-nav-screen-menu-group .items {
|
|
61
|
+
visibility: hidden;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.pr-nav-screen-menu-group.open .items {
|
|
65
|
+
visibility: visible;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.pr-nav-screen-menu-group.open {
|
|
69
|
+
padding-bottom: 10px;
|
|
70
|
+
height: auto;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.pr-nav-screen-menu-group.open .button {
|
|
74
|
+
padding-bottom: 6px;
|
|
75
|
+
color: var(--pr-c-brand);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.pr-nav-screen-menu-group.open .button-icon {
|
|
79
|
+
/*rtl:ignore*/
|
|
80
|
+
transform: rotate(45deg);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.button {
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: space-between;
|
|
86
|
+
align-items: center;
|
|
87
|
+
padding: 12px 4px 11px 0;
|
|
88
|
+
width: 100%;
|
|
89
|
+
line-height: 24px;
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
color: var(--pr-c-text-1);
|
|
93
|
+
transition: color 0.25s;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.button:hover {
|
|
97
|
+
color: var(--pr-c-brand);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.button-icon {
|
|
101
|
+
width: 14px;
|
|
102
|
+
height: 14px;
|
|
103
|
+
fill: var(--pr-c-text-2);
|
|
104
|
+
transition: fill 0.5s, transform 0.25s;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.group:first-child {
|
|
108
|
+
padding-top: 0px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.group + .group,
|
|
112
|
+
.group + .item {
|
|
113
|
+
padding-top: 4px;
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { inject } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
text: string
|
|
6
|
+
link: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const closeScreen = inject('close-screen') as () => void
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<AppLink class="pr-nav-screen-menu-group-link" :to="link" @click="closeScreen">
|
|
14
|
+
{{ text }}
|
|
15
|
+
</AppLink>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<style scoped>
|
|
19
|
+
.pr-nav-screen-menu-group-link {
|
|
20
|
+
display: block;
|
|
21
|
+
margin-left: 12px;
|
|
22
|
+
line-height: 32px;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
color: var(--pr-c-text-1);
|
|
26
|
+
transition: color 0.25s;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.pr-nav-screen-menu-group-link:hover {
|
|
30
|
+
color: var(--pr-c-brand);
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { NavItemLink } from '../types'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
text?: string
|
|
6
|
+
// todo
|
|
7
|
+
items: NavItemLink[]
|
|
8
|
+
}>()
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div class="pr-nav-screen-menu-group-section">
|
|
13
|
+
<p v-if="text" class="title">
|
|
14
|
+
{{ text }}
|
|
15
|
+
</p>
|
|
16
|
+
<PressNavScreenMenuGroupLink
|
|
17
|
+
v-for="item in items"
|
|
18
|
+
:key="item.text"
|
|
19
|
+
:text="item.text"
|
|
20
|
+
:link="item.link"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<style scoped>
|
|
26
|
+
.pr-nav-screen-menu-group-section {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.title {
|
|
31
|
+
line-height: 32px;
|
|
32
|
+
font-size: 13px;
|
|
33
|
+
font-weight: 700;
|
|
34
|
+
color: var(--pr-c-text-2);
|
|
35
|
+
transition: color 0.25s;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { inject } from 'vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{
|
|
5
|
+
text: string
|
|
6
|
+
link: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const closeScreen = inject('close-screen') as () => void
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<AppLink class="pr-nav-screen-menu-link" :href="link" @click="closeScreen">
|
|
14
|
+
{{ text }}
|
|
15
|
+
</AppLink>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<style scoped>
|
|
19
|
+
.pr-nav-screen-menu-link {
|
|
20
|
+
display: block;
|
|
21
|
+
border-bottom: 1px solid var(--pr-c-divider);
|
|
22
|
+
padding: 12px 0 11px;
|
|
23
|
+
line-height: 24px;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
color: var(--pr-c-text-1);
|
|
27
|
+
transition: border-color 0.25s, color 0.25s;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.pr-nav-screen-menu-link:hover {
|
|
31
|
+
color: var(--pr-c-brand);
|
|
32
|
+
}
|
|
33
|
+
</style>
|