Skip to content

Commit 7739a56

Browse files
committed
feat: new features
1 parent 8c66423 commit 7739a56

File tree

6 files changed

+83
-47
lines changed

6 files changed

+83
-47
lines changed

docs/valaxy.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default defineConfig<ThemeConfig>({
3737
link: '/guide/writing/asset-handling',
3838
},
3939
{
40-
text: 'fFrontmatter',
40+
text: 'Frontmatter',
4141
link: '/guide/writing/frontmatter',
4242
},
4343
{
@@ -85,7 +85,10 @@ export default defineConfig<ThemeConfig>({
8585
title: 'VALAXY THEME OCEANUS',
8686
// motto: '简约、高雅的 Valaxy 文档主题',
8787
motto: 'Sliding content with sticky tab nav',
88-
img: 'https://w.wallhaven.cc/full/85/wallhaven-85yl61.png',
88+
img: {
89+
light: 'https://common.s3.bitiful.net/oceanus/wallhaven-2y7yz6.jpg',
90+
dark: 'https://common.s3.bitiful.net/oceanus/wallhaven-2evj3y.jpg',
91+
},
8992
},
9093

9194
// sidebar: [

theme/components/OceanusArticle.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const sidebar = computed(() => secondNavItems.value?.sidebar || firstNavItems.va
3030
<slot />
3131

3232
<slot name="toc">
33-
<div class="border-l-1px border-$oceanus-c-border-line">
33+
<div class="toc border-l-1px border-$oceanus-c-border-line">
3434
<OceanusToc />
3535
</div>
3636
</slot>
@@ -49,11 +49,11 @@ const sidebar = computed(() => secondNavItems.value?.sidebar || firstNavItems.va
4949
display: flex;
5050
5151
.article-container {
52-
border-right: 1px solid rgba(0, 0, 0, 0.04);
52+
border-right: 1px solid var(--oceanus-c-divider);
5353
}
5454
5555
.article-left-aside {
56-
border-left: 1px solid rgba(0, 0, 0, 0.04);
56+
border-left: 1px solid var(--oceanus-c-divider);
5757
width: 0;
5858
visibility: hidden;
5959
// overflow: hidden;

theme/components/OceanusHero.vue

Lines changed: 15 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
<script setup lang="ts">
2+
import { useAppStore } from 'valaxy'
3+
import { computed } from 'vue'
24
import { useThemeConfig } from '../composables'
35
6+
const appStore = useAppStore()
47
const themeConfig = useThemeConfig()
8+
9+
const heroImg = computed(() => {
10+
const img = themeConfig.value.hero.img
11+
if (typeof img === 'string')
12+
return img
13+
else if (typeof img === 'object')
14+
return appStore.isDark ? img.dark : img.light
15+
16+
console.error('Invalid favicon type, check ThemeConfig.hero.img config')
17+
return ''
18+
})
519
</script>
620

721
<template>
8-
<div class="oceanus-hero" :style="{ backgroundImage: `url(${themeConfig.hero.img})` }">
22+
<div class="oceanus-hero" :style="{ backgroundImage: `url(${heroImg})` }">
923
<div class="hero-content">
1024
<p class="hero-title">
1125
<slot name="intro-text">
@@ -18,16 +32,6 @@ const themeConfig = useThemeConfig()
1832
{{ themeConfig.hero.motto }}
1933
</slot>
2034
</p>
21-
22-
<!-- CTA Buttons -->
23-
<!-- <div class="hero-buttons">
24-
<button class="cta-primary">
25-
Get Started
26-
</button>
27-
<button class="cta-secondary">
28-
Learn More
29-
</button>
30-
</div> -->
3135
</div>
3236
</div>
3337
</template>
@@ -90,36 +94,6 @@ const themeConfig = useThemeConfig()
9094
gap: 1rem;
9195
}
9296
93-
.cta-primary,
94-
.cta-secondary {
95-
padding: 0.75rem 2rem;
96-
border-radius: 24px;
97-
font-size: 1rem;
98-
cursor: pointer;
99-
transition: all 0.3s ease-in-out;
100-
}
101-
102-
.cta-primary {
103-
background-color: #0071e3;
104-
color: white;
105-
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
106-
107-
&:hover {
108-
background-color: #005bb5;
109-
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
110-
}
111-
}
112-
113-
.cta-secondary {
114-
background-color: transparent;
115-
border: 1px solid #ffffff;
116-
color: white;
117-
118-
&:hover {
119-
background-color: rgba(255, 255, 255, 0.1);
120-
}
121-
}
122-
12397
@keyframes fade-in {
12498
from {
12599
opacity: 0;

theme/styles/index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
@use './markdown' as *;
33

44
@use 'valaxy/client/styles/common/index.scss' as *;
5+
6+
@use 'markdown-it-github-alerts/styles/github-colors-light.css' as *;
7+
@use 'markdown-it-github-alerts/styles/github-colors-dark-media.css' as *;
8+
@use 'markdown-it-github-alerts/styles/github-base.css' as *;

theme/styles/markdown.scss

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,56 @@ html.dark {
6060
content: none;
6161
}
6262
}
63+
64+
// lang
65+
div[class*='language-'].line-numbers-mode {
66+
/* rtl:ignore */
67+
padding-left: 32px;
68+
}
69+
70+
.line-numbers-wrapper {
71+
position: absolute;
72+
top: 0;
73+
bottom: 0;
74+
75+
/* rtl:ignore */
76+
left: 0;
77+
z-index: 3;
78+
79+
/* rtl:ignore */
80+
border-right: 1px solid var(--va-code-block-divider-color);
81+
padding-top: 20px;
82+
width: 32px;
83+
text-align: center;
84+
font-family: var(--va-font-family-mono);
85+
line-height: var(--va-code-line-height);
86+
font-size: var(--va-code-font-size);
87+
color: var(--va-code-line-number-color);
88+
transition:
89+
border-color 0.5s,
90+
color 0.5s;
91+
}
92+
93+
// table
94+
.table-container {
95+
table {
96+
thead {
97+
th {
98+
text-align: left;
99+
border: 1px solid rgba(var(--va-c-primary-rgb), 0.3);
100+
background-color: rgba(var(--va-c-primary-rgb), 0.1);
101+
}
102+
}
103+
104+
td {
105+
border: 1px solid rgba(var(--va-c-primary-rgb), 0.3);
106+
}
107+
108+
tr {
109+
&:hover {
110+
background-color: rgba(var(--va-c-primary-rgb), 0.05);
111+
}
112+
}
113+
}
114+
}
63115
}

theme/types/index.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export interface ThemeConfig extends DefaultTheme.Config {
2222
hero: Partial<{
2323
title: string
2424
motto: string
25-
img: string
25+
img: string | {
26+
light: string
27+
dark: string
28+
}
2629
}>
2730

2831
sidebar: SidebarMulti

0 commit comments

Comments
 (0)