Skip to content

Commit 495c6a9

Browse files
committed
feat: update demo layout style
1 parent 0ddaf04 commit 495c6a9

File tree

7 files changed

+58
-21
lines changed

7 files changed

+58
-21
lines changed

public/favicon.ico

10.9 KB
Binary file not shown.

src/assets/base.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,7 @@ body {
5858
opacity: .1;
5959
pointer-events: none;
6060
touch-action: none;
61+
top: 0;
62+
left: 0;
6163
}
6264
}

src/assets/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
#app {
1818
display: grid;
1919
grid-template-rows: 1fr auto auto;
20-
padding: 0 2rem;
20+
max-width: 1000px;
2121
}
2222
}

src/components/Footer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const currentYear = new Date().getFullYear()
44

55
<template>
66
<footer>
7-
<p>仅用于个人非商用</P>
7+
<p>仅限个人非商用</P>
88
<p>
99
© 2019 - {{ currentYear }}
1010
<a href="https://github.com/Lruihao/mmt-webfont/" target="_blank">沐目体</a>

src/components/SectionCover.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<a
55
href="https://github.com/Lruihao/mmt-webfont"
66
class="github-corner"
7+
target="_blank"
78
aria-label="View source on GitHub"
89
>
910
<svg
1011
width="80"
1112
height="80"
1213
viewBox="0 0 250 250"
13-
style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;"
1414
aria-hidden="true"
1515
>
1616
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z" />
@@ -34,6 +34,16 @@
3434
position: fixed;
3535
top: 0;
3636
right: 0;
37+
z-index: 100;
38+
39+
svg {
40+
fill: var(--github-corner-fill, #151513);
41+
color: var(--github-corner-color, #fff);
42+
position: absolute;
43+
top: 0;
44+
border: 0;
45+
right: 0;
46+
}
3747
}
3848
.github-corner:hover .octo-arm {
3949
animation: octocat-wave 560ms ease-in-out;
@@ -66,4 +76,11 @@
6676
animation: octocat-wave 560ms ease-in-out;
6777
}
6878
}
79+
80+
@media (prefers-color-scheme: dark) {
81+
.github-corner {
82+
--github-corner-fill: #fff;
83+
--github-corner-color: #151513;
84+
}
85+
}
6986
</style>

src/components/SectionMusic.vue

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface Comment {
1212
}
1313
1414
const mid = ref<string>('2280569152')
15+
const loading = ref<boolean>(false)
1516
const defaultComment: Comment = {
1617
musicName: '',
1718
musicUrl: '',
@@ -24,6 +25,7 @@ const defaultComment: Comment = {
2425
const comment = ref<Comment>(defaultComment)
2526
2627
function getRandomComment() {
28+
loading.value = true
2729
fetch(`https://api.lruihao.cn/netease/comment?mid=${mid.value}`)
2830
.then(response => response.json())
2931
.then((res) => {
@@ -43,6 +45,9 @@ function getRandomComment() {
4345
content: '获取评论失败,请稍后再试...',
4446
}
4547
})
48+
.finally(() => {
49+
loading.value = false
50+
})
4651
}
4752
4853
onMounted(() => {
@@ -52,7 +57,7 @@ onMounted(() => {
5257

5358
<template>
5459
<section class="section-music">
55-
<div class="comment-163" title="随机下一条" @click="getRandomComment">
60+
<div v-if="!loading" class="comment-163" title="随机下一条" @click="getRandomComment">
5661
<span class="pic-backdrop" :style="comment.picUrl ? `background-image: url(${comment.picUrl});` : ''" />
5762
<div class="commentator">
5863
<img
@@ -63,38 +68,38 @@ onMounted(() => {
6368
>
6469
<span class="comment-nickname">{{ comment.nickname }}</span>
6570
</div>
66-
<div v-if="comment.content" class="comment-content">
71+
<div class="comment-content">
6772
{{ comment.content }}
6873
</div>
69-
<div v-else class="loading-indicator-wrapper">
70-
<div class="aether-spinner">
71-
<div class="rect-one" />
72-
<div class="rect-two" />
73-
<div class="rect-three" />
74-
</div>
75-
</div>
7674
<div class="music-info">
77-
<span class="artists-name">{{ comment.artist }}</span>
7875
<span class="music-name">{{ comment.musicName }}</span>
76+
<span class="artists-name">{{ comment.artist }}</span>
77+
</div>
78+
</div>
79+
<div v-else class="loading-indicator-wrapper">
80+
<div class="aether-spinner">
81+
<div class="rect-one" />
82+
<div class="rect-two" />
83+
<div class="rect-three" />
7984
</div>
8085
</div>
8186
</section>
8287
</template>
8388

8489
<style scoped>
8590
.section-music {
91+
position: relative;
8692
z-index: 1;
8793
padding: 1rem;
8894
min-height: 185px;
89-
--color-comment: #272626;
9095
9196
.comment-163 {
9297
font-family: MMT, '沐目体';
9398
position: relative;
9499
border: 1px solid #f5f5f5;
95100
padding: 0.75em;
96101
border-radius: 0.75rem;
97-
color: var(--color-comment);
102+
color: var(--color-comment, #272626);
98103
cursor: pointer;
99104
height: 100%;
100105
}
@@ -146,28 +151,37 @@ onMounted(() => {
146151
.music-info {
147152
display: flex;
148153
align-items: center;
149-
flex-direction: row-reverse;
150-
font-weight: 500;
154+
justify-content: flex-end;
151155
font-size: 1.2rem;
152156
margin-top: 0.75em;
157+
text-shadow: 0 0 4px var(--color-text-shadow, rgba(0, 0, 0, .4));
158+
}
159+
.music-name:not(:empty)::before {
160+
content: '';
161+
}
162+
.artists-name:not(:empty)::after {
163+
content: '';
153164
}
154165
.music-name:not(:empty)::after {
155-
content: '-';
156-
margin-left: 0.25rem;
157-
margin-right: 0.25rem;
166+
content: '·';
167+
margin-inline: 0.25rem;
158168
}
159169
.mmt-netease-powered {
160-
display: blcok;
170+
display: block;
161171
text-align: right;
162172
font-size: 80%;
163173
color: #999;
164174
margin-block: 0.5rem;
165175
}
166176
}
177+
167178
@media (prefers-color-scheme: dark) {
168179
.section-music {
169180
--color-comment: #f5f5f5;
170181
}
182+
.music-info {
183+
--color-text-shadow: rgba(255, 255, 255, .8);
184+
}
171185
}
172186
173187
.loading-indicator-wrapper {

src/components/SectionPreview.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const style = computed(() => {
1414
}
1515
})
1616
17+
if (window.innerWidth < 768) {
18+
fontSize.value = 20
19+
}
20+
1721
// ————“沐目之,湘也。”
1822
// 取字于大学时初恋的名字,这个字体也是为她而写。
1923
// 沐目体和红人馆的那首《最甜情歌》有着类似的遭遇。

0 commit comments

Comments
 (0)