Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit e0c3e70

Browse files
committed
feat: ui update, use narrow layout by default
1 parent b2f4d20 commit e0c3e70

File tree

12 files changed

+136
-137
lines changed

12 files changed

+136
-137
lines changed

src/components/Header.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export default {
8181
z-index: 33;
8282
border-bottom: 1px solid var(--border-color);
8383
background: var(--header-background);
84+
color: var(--header-text-color);
8485
8586
@media print {
8687
position: static;
@@ -100,7 +101,7 @@ export default {
100101
white-space: nowrap;
101102
102103
& a {
103-
color: var(--text-color);
104+
color: inherit;
104105
text-decoration: none;
105106
}
106107
}
@@ -126,7 +127,7 @@ export default {
126127
position: absolute;
127128
right: 20px;
128129
top: 0;
129-
height: calc(var(--header-height) - 1px);
130+
height: 100%;
130131
background: var(--header-background);
131132
132133
@media print {

src/components/HeaderNav.vue

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<div class="header-nav-item" v-for="(item, index) in nav" :key="index">
44
<div class="dropdown-wrapper" v-if="item.children">
55
<span class="dropdown-trigger">
6-
{{ item.title }} <span class="arrow"></span>
6+
{{ item.title }}
7+
<span class="arrow"></span>
78
</span>
89
<ul class="dropdown-list" v-if="item.children">
910
<li
@@ -14,6 +15,7 @@
1415
<uni-link
1516
:to="childItem.link"
1617
:openInNewTab="childItem.openInNewTab"
18+
:externalLinkIcon="false"
1719
>{{ childItem.title }}</uni-link
1820
>
1921
</li>
@@ -24,6 +26,7 @@
2426
v-if="!item.children"
2527
:to="item.link"
2628
:openInNewTab="item.openInNewTab"
29+
:externalLinkIcon="false"
2730
>{{ item.title }}</uni-link
2831
>
2932
</div>
@@ -56,7 +59,7 @@ export default {
5659
.header-nav {
5760
display: flex;
5861
align-items: center;
59-
font-size: 0.9rem;
62+
font-size: 1rem;
6063
6164
@media (max-width: 768px) {
6265
display: none;
@@ -68,21 +71,34 @@ export default {
6871
}
6972
7073
.header-nav-item {
74+
height: 100%;
75+
7176
&:not(:first-child) {
7277
margin-left: 25px;
7378
}
7479
7580
& > /deep/ a {
76-
border-bottom: 2px solid transparent;
77-
display: inline-block;
81+
display: flex;
82+
align-items: center;
7883
line-height: 1.4;
84+
height: 100%;
85+
position: relative;
7986
80-
&:not(.is-external-link):hover {
81-
border-color: var(--nav-link-hover-border-color);
87+
&:after {
88+
content: '';
89+
height: 2px;
90+
width: 100%;
91+
position: absolute;
92+
bottom: 0;
93+
left: 0;
94+
right: 0;
95+
display: block;
8296
}
8397
84-
&:not(.is-external-link).router-link-exact-active {
85-
border-color: var(--accent-color);
98+
&.router-link-exact-active {
99+
&:after {
100+
background-color: var(--nav-link-border-color);
101+
}
86102
}
87103
}
88104
}

src/components/Sidebar.vue

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
v-for="(item, index) in $store.getters.sidebar"
1515
:key="index"
1616
:item="item"
17-
:open="openItems.indexOf(index) !== -1"
17+
:open="closedItems.indexOf(index) === -1"
1818
@toggle="toggleItem(index)"
1919
/>
2020
</div>
@@ -35,7 +35,7 @@ export default {
3535
},
3636
data() {
3737
return {
38-
openItems: []
38+
closedItems: []
3939
}
4040
},
4141
watch: {
@@ -52,15 +52,15 @@ export default {
5252
},
5353
methods: {
5454
openItem(index) {
55-
if (this.openItems.indexOf(index) === -1) {
56-
this.openItems.push(index)
55+
if (this.closedItems.indexOf(index) > -1) {
56+
this.closedItems = this.closedItems.filter(v => v !== index)
5757
}
5858
},
5959
toggleItem(index) {
60-
if (this.openItems.indexOf(index) === -1) {
61-
this.openItems.push(index)
60+
if (this.closedItems.indexOf(index) === -1) {
61+
this.closedItems.push(index)
6262
} else {
63-
this.openItems = this.openItems.filter(v => v !== index)
63+
this.closedItems = this.closedItems.filter(v => v !== index)
6464
}
6565
},
6666
getCurrentIndex(currentPath, sidebarItems) {
@@ -91,9 +91,8 @@ export default {
9191
bottom: 0;
9292
z-index: 9;
9393
overflow-y: auto;
94-
padding: 30px 0;
94+
padding: 40px 0 30px 0;
9595
word-break: break-word;
96-
border-right: 1px solid var(--border-color);
9796
9897
& a {
9998
text-decoration: none;
@@ -105,6 +104,8 @@ export default {
105104
transform: translateX(-100%);
106105
width: 80%;
107106
transition: transform 0.5s cubic-bezier(0.5, 0.32, 0.01, 1);
107+
padding: 30px 0;
108+
border-right: 1px solid var(--border-color);
108109
109110
&.isShown {
110111
transform: translateX(0);

src/components/SidebarItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default {
116116
117117
font-size: 0.875rem;
118118
119-
& a {
119+
& /deep/ a {
120120
color: var(--sidebar-link-color);
121121
122122
&:hover {

src/components/UniLink.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ import {isExternalLink} from '../utils'
44
export default {
55
functional: true,
66
7-
render(h, {data, children}) {
7+
props: ['openInNewTab', 'externalLinkIcon'],
8+
9+
render(
10+
h,
11+
{
12+
data,
13+
children,
14+
props: {openInNewTab, externalLinkIcon}
15+
}
16+
) {
817
const attrs = {...data.attrs}
9-
const {to, openInNewTab} = attrs
10-
delete attrs.openInNewTab
18+
const {to} = attrs
19+
1120
if (isExternalLink(to)) {
1221
delete attrs.to
1322
delete attrs.prefetchFiles
@@ -24,7 +33,7 @@ export default {
2433
},
2534
[
2635
...children,
27-
openInNewTab === false
36+
openInNewTab === false || externalLinkIcon === false
2837
? null
2938
: h('external-link-icon', {class: 'external-link-icon'})
3039
]

src/css/main.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ a {
1717
}
1818

1919
.Content a {
20-
color: var(--accent-color);
2120
&:hover {
2221
text-decoration: underline;
2322
}
@@ -33,7 +32,7 @@ a {
3332
}
3433

3534
.Wrap {
36-
max-width: 1060px;
35+
max-width: 1180px;
3736
}
3837

3938
.layout-wide .Wrap {

src/css/page-content.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,16 @@
9494
font-size: 12px;
9595
color: #cacaca;
9696
}
97+
98+
& code {
99+
color: var(--code-block-text-color);
100+
}
97101
}
98102

99103
& pre,
100104
& .code-mask {
101105
overflow: auto;
102106
position: relative;
103-
font-size: 13px;
104107
margin: 0;
105108
z-index: 2;
106109
font-family: var(--code-font);
@@ -111,7 +114,7 @@
111114
margin: 0;
112115
padding: 0;
113116
border: none;
114-
font-size: 100%;
117+
font-size: 1em;
115118
background: transparent;
116119
}
117120

0 commit comments

Comments
 (0)