Skip to content

Commit 591e035

Browse files
authored
Fix mobile home page layout spacing (#9)
1 parent 3a77422 commit 591e035

2 files changed

Lines changed: 84 additions & 13 deletions

File tree

‎docs/.vitepress/theme/components/HeroCarousel.vue‎

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ onUnmounted(() => {
9494
align-items: center;
9595
justify-content: center;
9696
gap: 10px;
97+
padding: 12px 0 8px;
9798
}
9899
99100
.carousel-link {
@@ -168,28 +169,53 @@ onUnmounted(() => {
168169
169170
@media (max-width: 768px) {
170171
.hero-carousel {
172+
position: relative;
173+
inset: auto;
171174
justify-content: flex-start;
172-
gap: 8px;
175+
gap: 12px;
176+
width: 100%;
177+
height: 100%;
178+
padding: 0;
173179
}
174180
175181
.carousel-link {
176182
position: static;
177-
order: -1;
183+
order: 2;
178184
align-self: center;
179185
justify-content: center;
180-
max-width: min(100%, 240px);
181-
font-size: 12px;
186+
max-width: min(100%, 260px);
187+
font-size: 14px;
182188
text-align: center;
189+
line-height: 1.5;
183190
}
184191
185192
.carousel-stage {
193+
order: 0;
194+
flex: 0 0 auto;
186195
padding-top: 0;
187196
width: 100%;
197+
min-height: min(60vw, 240px);
198+
}
199+
200+
.carousel-dots {
201+
order: 1;
202+
padding-bottom: 0;
188203
}
189204
190205
.carousel-img {
191206
width: 100%;
192207
height: 100%;
193208
}
194209
}
210+
211+
@media (max-width: 480px) {
212+
.carousel-link {
213+
max-width: min(100%, 240px);
214+
font-size: 13px;
215+
}
216+
217+
.carousel-stage {
218+
min-height: min(56vw, 220px);
219+
}
220+
}
195221
</style>

‎docs/.vitepress/theme/index.css‎

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@
8181
}
8282

8383
.VPNavBarTitle .title {
84-
max-width: calc(100vw - 156px);
84+
max-width: calc(100vw - 132px);
8585
white-space: nowrap;
8686
overflow: hidden;
8787
text-overflow: ellipsis;
8888
}
8989

9090
/* 首页 hero 区域适配 */
9191
.VPHero {
92-
padding-top: 32px !important;
92+
padding-top: 40px !important;
9393
padding-bottom: 24px !important;
9494
}
9595

@@ -98,14 +98,22 @@
9898
width: 100% !important;
9999
}
100100

101+
.VPHero .container {
102+
padding-left: 20px !important;
103+
padding-right: 20px !important;
104+
}
105+
101106
.VPHero .image {
102-
margin: 0 auto 8px !important;
107+
margin: 0 auto 16px !important;
103108
order: -1;
109+
width: 100% !important;
104110
}
105111

106112
.VPHero .image-container {
107-
width: min(64vw, 260px) !important;
108-
height: min(64vw, 260px) !important;
113+
width: min(72vw, 300px) !important;
114+
height: auto !important;
115+
min-height: min(86vw, 360px) !important;
116+
margin: 0 auto !important;
109117
}
110118

111119
.VPHero .image-bg {
@@ -151,11 +159,15 @@
151159
padding: 12px 20px !important;
152160
font-size: 16px !important;
153161
height: auto !important;
162+
min-height: 56px !important;
154163
line-height: 1.5 !important;
155164
border-radius: 999px !important;
165+
white-space: normal !important;
166+
text-align: center !important;
167+
overflow-wrap: anywhere;
156168
}
157169

158-
/* 首页 feature 卡片全宽显示 */
170+
/* 首页 feature 卡片全宽显示,避免文本被截断 */
159171
.VPHomeFeatures,
160172
.VPFeatures,
161173
.VPFeatures .container {
@@ -164,10 +176,15 @@
164176
padding-right: 0 !important;
165177
}
166178

179+
.VPFeatures {
180+
padding: 0 16px !important;
181+
}
182+
167183
.VPFeatures .items {
168184
display: flex !important;
169185
flex-direction: column !important;
170186
gap: 16px !important;
187+
margin: 0 !important;
171188
}
172189

173190
.VPFeatures .items .item {
@@ -176,20 +193,48 @@
176193
padding: 0 !important;
177194
}
178195

196+
.VPFeature,
197+
.VPFeature .box {
198+
height: auto !important;
199+
min-height: 0 !important;
200+
}
201+
179202
.VPFeature {
180203
padding: 20px !important;
181204
border-radius: 24px !important;
182205
}
206+
207+
.VPFeature .box {
208+
padding: 0 !important;
209+
}
210+
211+
.VPFeature .title,
212+
.VPFeature .details {
213+
white-space: normal !important;
214+
overflow: visible !important;
215+
text-overflow: unset !important;
216+
word-break: break-word;
217+
overflow-wrap: anywhere;
218+
}
183219
}
184220

185221
@media (max-width: 480px) {
186222
.VPNavBarTitle .title {
187-
max-width: calc(100vw - 132px);
223+
max-width: calc(100vw - 120px);
224+
}
225+
226+
.VPHero {
227+
padding-top: 32px !important;
188228
}
189229

190230
.VPHero .container {
191-
padding-left: 24px !important;
192-
padding-right: 24px !important;
231+
padding-left: 16px !important;
232+
padding-right: 16px !important;
233+
}
234+
235+
.VPHero .image-container {
236+
width: min(78vw, 300px) !important;
237+
min-height: min(94vw, 360px) !important;
193238
}
194239

195240
.VPFeature {

0 commit comments

Comments
 (0)