Skip to content

Commit 87f16bf

Browse files
committed
style: format code
1 parent d829473 commit 87f16bf

26 files changed

+590
-300
lines changed

.vitepress/theme/components/Card.vue

Lines changed: 203 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { computed } from 'vue'
44
55
import { isLinkExternal, isRelativeLink } from '../utils'
66
7-
import '../styles/card.scss'
8-
97
interface CardProps {
108
/** Card title */
119
title: string
@@ -167,3 +165,206 @@ const descText = computed(() => {
167165
<span class="i-logos-google-drive" />
168166
</div>
169167
</template>
168+
169+
<style lang="scss">
170+
.card {
171+
display: flex;
172+
flex-wrap: wrap;
173+
flex-direction: row;
174+
align-content: flex-start;
175+
justify-content: flex-start;
176+
align-items: center;
177+
border-radius: 0.75rem;
178+
border: 1px solid transparent;
179+
background-color: var(--vp-c-bg-alt);
180+
color: inherit;
181+
182+
transition:
183+
all 0.5s,
184+
box-shadow 0.25s ease,
185+
border-color 0.25s ease !important;
186+
187+
text-decoration: none !important;
188+
189+
&:hover {
190+
border: 1px var(--vp-c-brand-2) solid;
191+
}
192+
}
193+
194+
.card-hover:hover {
195+
transform: translate3d(0, -4px, 0);
196+
border-color: var(--vp-c-brand-1);
197+
box-shadow: var(--vp-shadow-2);
198+
}
199+
200+
[card-grid] {
201+
display: grid;
202+
gap: 2rem;
203+
grid-template-columns: repeat(1, minmax(0, 1fr));
204+
}
205+
206+
@media (min-width: 640px) {
207+
[card-grid] {
208+
grid-template-columns: repeat(2, minmax(0, 1fr));
209+
}
210+
}
211+
212+
.card-theme-normal {
213+
max-width: 360px;
214+
margin: 1rem 0.5rem;
215+
216+
.card-cover-contanier {
217+
position: relative;
218+
overflow: hidden;
219+
width: auto;
220+
margin: 0;
221+
height: 160px;
222+
border-radius: 0.75rem 0.75rem 0 0;
223+
}
224+
225+
.card-footer {
226+
display: flex;
227+
flex-wrap: nowrap;
228+
flex-direction: row;
229+
justify-content: center;
230+
align-items: center;
231+
width: auto;
232+
padding: 1.25rem 1rem;
233+
margin: 0;
234+
}
235+
236+
hr {
237+
margin: 0.25em 0;
238+
}
239+
}
240+
241+
@media (max-width: 419px) {
242+
.card-theme-normal {
243+
max-width: 95%;
244+
}
245+
}
246+
247+
.card-icon {
248+
width: 2em !important;
249+
height: 2em !important;
250+
background-color: var(--vp-c-bg-soft);
251+
margin-right: 1em;
252+
padding: 1em;
253+
}
254+
255+
.card-logo {
256+
width: 3em;
257+
height: 3em;
258+
margin-right: 1em;
259+
border-radius: 50%;
260+
}
261+
262+
.card-content,
263+
.card-footer {
264+
flex: 1;
265+
width: calc(100% - 6em);
266+
}
267+
268+
.card-title {
269+
font-weight: 500;
270+
font-size: 1.1em;
271+
width: 95%;
272+
font-family: var(--vp-font-family-subtitle);
273+
text-overflow: ellipsis;
274+
white-space: nowrap;
275+
overflow: hidden;
276+
}
277+
278+
.card-desc {
279+
color: #888;
280+
font-size: 0.9em;
281+
line-height: 1.5;
282+
overflow-wrap: anywhere;
283+
}
284+
285+
.card-container {
286+
display: flex;
287+
flex-wrap: wrap;
288+
align-content: stretch;
289+
align-items: stretch;
290+
justify-content: center;
291+
292+
.card {
293+
flex-basis: calc(50% - 3rem);
294+
max-width: unset;
295+
margin: 0.5rem;
296+
297+
@media (max-width: 959px) {
298+
flex-basis: 100%;
299+
}
300+
301+
@media (max-width: 719px) {
302+
font-size: 0.95rem;
303+
}
304+
305+
@media (max-width: 419px) {
306+
font-size: 0.9rem;
307+
}
308+
}
309+
}
310+
311+
.card-theme-medium {
312+
width: auto;
313+
margin: 1rem 0.5rem;
314+
padding: 0.38rem;
315+
316+
.card-footer {
317+
display: flex;
318+
align-items: center;
319+
}
320+
321+
.no-logo {
322+
padding-left: 1rem;
323+
}
324+
325+
.card-logo {
326+
width: 2.5rem;
327+
height: 2.5rem;
328+
margin-left: 0.4rem;
329+
}
330+
331+
.card-icon {
332+
margin-left: 0.5rem;
333+
}
334+
335+
.card-title {
336+
font-size: 1rem;
337+
}
338+
339+
.card-desc {
340+
width: 95%;
341+
text-overflow: ellipsis;
342+
white-space: nowrap;
343+
overflow: hidden;
344+
}
345+
346+
&::after {
347+
content: '';
348+
--card-icon: url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M6 7c0 .55.45 1 1 1h7.59l-8.88 8.88a.996.996 0 1 0 1.41 1.41L16 9.41V17c0 .55.45 1 1 1s1-.45 1-1V7c0-.55-.45-1-1-1H7c-.55 0-1 .45-1 1z'/%3E%3C/svg%3E");
349+
mask: var(--card-icon) no-repeat !important;
350+
-webkit-mask: var(--card-icon) no-repeat !important;
351+
mask-position: center;
352+
-webkit-mask-position: center;
353+
mask-size: 100% 100%;
354+
background-color: currentColor;
355+
width: 18px !important;
356+
height: 18px !important;
357+
margin-top: -26px !important;
358+
color: #ccc !important;
359+
transform: scale(0.85);
360+
}
361+
362+
&[is-external-link='false']::after {
363+
display: none;
364+
}
365+
366+
hr {
367+
display: none;
368+
}
369+
}
370+
</style>

.vitepress/theme/components/DocReaction.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const feedbackMessage = computed(() => {
3434
: theme.value.docReaction.feedbackFailMsg
3535
})
3636
37-
const additionalMessage = computed(() => {
37+
const additionalMessage = computed((): string => {
3838
const isFormEditingOrSuccess = feedbackForm.value?.isEditing || reaction.setReactionResponse?.statusCode === 200
3939
const isDislikeState = reaction.reactionState === 'dislike'
4040
@@ -54,7 +54,7 @@ const styles = computed(() => {
5454
}
5555
}
5656
return {
57-
container: 'border-t border-[var(--vp-c-divider)] border-t pt-36px mt-24px grid gap-row-8px',
57+
container: 'border-t border-[var(--vp-c-divider)] border-t-solid border-t pt-36px mt-24px grid gap-row-8px',
5858
message: 'inline-block fill-current-color flex-basis-20px flex-shrink-0 font-size-1rem mr-2 font-[var(--vp-font-family-subtitle)]',
5959
buttonContainer: 'flex mt-3',
6060
button: 'font-size-20px h-36px line-height-36px mr-12px text-center w-60px rounded-4px bg-[var(--vp-c-bg-soft)]',

.vitepress/theme/composables/useSSOAuth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { useTokenManager } from './useTokenManager'
22
import { isObject } from 'lodash-es'
33
import { toCamelCaseObject } from '@/utils'
4-
import { oauth as interKnotOauth } from '../apis/inter-knot.site/'
4+
import { oauth as interKnotOauth } from '../apis/inter-knot.site'
55
import { createAuthError } from '../utils/auth-errors'
66
import { log, LogGroup } from '../utils/auth-logger'
77

.vitepress/theme/layouts/Headline.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ function handleButtonClick() {
4646

4747
<template>
4848
<div class="slide-enter Headline">
49-
<div class="border-b pb-6">
49+
<div class="pb-6 border-b">
5050
<div class="headline-header flex items-start justify-between">
5151
<div class="headline-content">
5252
<h1
53-
class="title text-3xl font-bold tracking-tight lg:text-5xl sm:text-4xl"
53+
class="title text-3xl tracking-tight font-bold lg:text-5xl sm:text-4xl"
5454
>
5555
{{ frontmatter.title }}
5656
</h1>
57-
<p class="lead mt-4 text-lg">
57+
<p class="lead text-lg mt-4">
5858
{{ frontmatter.subtext }}
5959
</p>
6060
<p v-if="frontmatter.action" class="action">

src/components/admin/AddEntryDialog.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -641,15 +641,15 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
641641
<!-- 键名树状结构 -->
642642
<div v-if="formData.category || newCategory" class="space-y-2">
643643
<Label>现有键名结构</Label>
644-
<div v-if="availableKeysTree.length > 0" class="max-h-[200px] overflow-auto border rounded p-3">
644+
<div v-if="availableKeysTree.length > 0" class="p-3 border rounded max-h-[200px] overflow-auto">
645645
<KeyTreeView
646646
:tree="availableKeysTree"
647647
:selected="formData.key"
648648
@select="handleKeySelect"
649649
/>
650650
</div>
651-
<div v-else class="border rounded p-3 text-center text-muted-foreground">
652-
<i class="i-lucide-folder-open mx-auto mb-2 h-6 w-6 opacity-50" />
651+
<div v-else class="text-muted-foreground p-3 text-center border rounded">
652+
<i class="i-lucide-folder-open mx-auto mb-2 opacity-50 h-6 w-6" />
653653
<p class="text-sm">
654654
该分类下暂无现有键名
655655
</p>
@@ -662,7 +662,7 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
662662
<!-- 数据类型选择 -->
663663
<div class="space-y-2">
664664
<Label>数据类型</Label>
665-
<div class="mb-2 text-xs text-muted-foreground">
665+
<div class="text-xs text-muted-foreground mb-2">
666666
当前选择: {{ formData.dataType }}
667667
</div>
668668
<Tabs :model-value="formData.dataType" class="w-full" @update:model-value="formData.dataType = $event">
@@ -709,8 +709,8 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
709709
</div>
710710

711711
<!-- 重复警告 -->
712-
<div v-if="duplicateWarning" class="rounded bg-destructive/10 p-3 text-sm text-destructive">
713-
<i class="i-lucide-alert-triangle mr-2 inline h-4 w-4" />
712+
<div v-if="duplicateWarning" class="text-sm text-destructive p-3 rounded bg-destructive/10">
713+
<i class="i-lucide-alert-triangle mr-2 h-4 w-4 inline" />
714714
{{ duplicateWarning }}
715715
</div>
716716

@@ -719,7 +719,7 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
719719
<Label>翻译内容</Label>
720720

721721
<!-- 语言切换标签页 -->
722-
<div class="flex gap-2 border-b">
722+
<div class="border-b flex gap-2">
723723
<Button
724724
v-for="locale in availableLocales"
725725
:key="locale"
@@ -746,7 +746,7 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
746746

747747
<!-- 正则表达式编辑器 -->
748748
<div v-else-if="formData.dataType === 'regex'" class="space-y-3">
749-
<div class="grid grid-cols-2 gap-4">
749+
<div class="gap-4 grid grid-cols-2">
750750
<div class="space-y-2">
751751
<Label>正则表达式模式</Label>
752752
<Input
@@ -770,7 +770,7 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
770770
<!-- 对象数组编辑器 -->
771771
<div v-else-if="formData.dataType === 'array'" class="space-y-4">
772772
<!-- 字段配置 -->
773-
<div class="border rounded p-3 space-y-3">
773+
<div class="p-3 border rounded space-y-3">
774774
<div class="flex items-center justify-between">
775775
<Label class="text-sm font-medium">字段配置</Label>
776776
<Button
@@ -786,7 +786,7 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
786786
<div
787787
v-for="(field, index) in arrayFieldConfig.fields"
788788
:key="index"
789-
class="grid grid-cols-4 items-end gap-2"
789+
class="gap-2 grid grid-cols-4 items-end"
790790
>
791791
<div class="space-y-1">
792792
<Label class="text-xs">字段名</Label>
@@ -839,11 +839,11 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
839839
<div
840840
v-for="(arrayItem, index) in parsedTranslations[editingLocale] || []"
841841
:key="index"
842-
class="border rounded-lg p-4 space-y-3"
842+
class="p-4 border rounded-lg space-y-3"
843843
>
844844
<div class="flex items-center justify-between">
845845
<span class="text-sm text-muted-foreground font-medium">项目 #{{ index + 1 }}</span>
846-
<div class="flex items-center gap-2">
846+
<div class="flex gap-2 items-center">
847847
<Button
848848
v-if="index > 0"
849849
size="sm"
@@ -872,7 +872,7 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
872872
</div>
873873
</div>
874874

875-
<div class="grid gap-3" :style="{ gridTemplateColumns: `repeat(${arrayFieldConfig.fields.length}, 1fr)` }">
875+
<div class="gap-3 grid" :style="{ gridTemplateColumns: `repeat(${arrayFieldConfig.fields.length}, 1fr)` }">
876876
<div
877877
v-for="field in arrayFieldConfig.fields"
878878
:key="field.name"
@@ -882,14 +882,14 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
882882
<Input
883883
:model-value="arrayItem[field.name] || ''"
884884
:placeholder="field.placeholder"
885-
class="bg-background text-xs font-mono focus:bg-background hover:bg-background"
885+
class="text-xs font-mono bg-background focus:bg-background hover:bg-background"
886886
@update:model-value="updateArrayItem(editingLocale, index, field.name, $event)"
887887
/>
888888
</div>
889889
</div>
890890
</div>
891891

892-
<div v-if="!(parsedTranslations[editingLocale] || []).length" class="py-4 text-center text-muted-foreground">
892+
<div v-if="!(parsedTranslations[editingLocale] || []).length" class="text-muted-foreground py-4 text-center">
893893
暂无数组项,点击上方"添加项目"按钮开始添加
894894
</div>
895895
</div>
@@ -899,8 +899,8 @@ function updateArrayFieldConfig(index: number, field: 'name' | 'displayName' | '
899899
<!-- JSON数据预览 -->
900900
<div v-if="jsonPreview" class="space-y-2">
901901
<Label>JSON数据预览</Label>
902-
<div class="max-h-[200px] overflow-auto border rounded bg-muted/30 p-3">
903-
<pre class="whitespace-pre-wrap text-xs font-mono">{{ jsonPreview }}</pre>
902+
<div class="p-3 border rounded bg-muted/30 max-h-[200px] overflow-auto">
903+
<pre class="text-xs font-mono whitespace-pre-wrap">{{ jsonPreview }}</pre>
904904
</div>
905905
</div>
906906
</div>

0 commit comments

Comments
 (0)