@@ -39,6 +39,38 @@ import TouchMeCard from './components/TouchMeCard'
3939import CONFIG from './config'
4040import { Style } from './style'
4141
42+ const IndexSkeleton = ( ) => (
43+ < div className = 'pt-10 md:pt-18' >
44+ < div className = 'w-full bg-[#f6f6f1] dark:bg-black' >
45+ < div className = 'mx-auto w-full max-w-screen-3xl px-4 py-10 lg:px-0' >
46+ < div className = 'grid gap-10 xl:grid-cols-2' >
47+ < section className = 'space-y-5' >
48+ < div className = 'h-80 w-full animate-pulse bg-gray-200 dark:bg-gray-800' />
49+ < div className = 'h-4 w-24 animate-pulse bg-gray-200 dark:bg-gray-800' />
50+ < div className = 'h-10 w-4/5 animate-pulse bg-gray-200 dark:bg-gray-800' />
51+ < div className = 'h-4 w-2/3 animate-pulse bg-gray-200 dark:bg-gray-800' />
52+ </ section >
53+ < section className = 'space-y-6' >
54+ < div className = 'h-48 w-full animate-pulse bg-gray-200 dark:bg-gray-800' />
55+ { [ 0 , 1 ] . map ( item => (
56+ < div
57+ key = { item }
58+ className = 'flex gap-6 border-t border-gray-300 pt-6 dark:border-gray-800' >
59+ < div className = 'min-w-0 flex-1 space-y-3' >
60+ < div className = 'h-4 w-20 animate-pulse bg-gray-200 dark:bg-gray-800' />
61+ < div className = 'h-6 w-4/5 animate-pulse bg-gray-200 dark:bg-gray-800' />
62+ < div className = 'h-4 w-2/3 animate-pulse bg-gray-200 dark:bg-gray-800' />
63+ </ div >
64+ < div className = 'h-32 w-32 shrink-0 animate-pulse bg-gray-200 dark:bg-gray-800' />
65+ </ div >
66+ ) ) }
67+ </ section >
68+ </ div >
69+ </ div >
70+ </ div >
71+ </ div >
72+ )
73+
4274// 主题全局状态
4375const ThemeGlobalMagzine = createContext ( )
4476export const useMagzineGlobal = ( ) => useContext ( ThemeGlobalMagzine )
@@ -75,7 +107,7 @@ const LayoutBase = props => {
75107 < div
76108 id = 'main'
77109 role = 'main'
78- className = 'flex-grow' // 这个类保证 main 区域填满剩余的空白
110+ className = 'flex-grow min-h-[60vh] bg-[#f6f6f1] dark:bg-black'
79111 >
80112 { children }
81113 </ div >
@@ -100,7 +132,11 @@ const LayoutBase = props => {
100132 * @returns
101133 */
102134const LayoutIndex = props => {
103- const { posts } = props
135+ const posts = Array . isArray ( props ?. posts ) ? props . posts : [ ]
136+
137+ if ( posts . length === 0 ) {
138+ return < IndexSkeleton />
139+ }
104140
105141 // ===== 1. Hero区域 =====
106142 const heroTopPosts = posts . slice ( 0 , 1 )
0 commit comments