@@ -8,9 +8,11 @@ import Link from 'next/link'
8
8
import type { PropsWithChildren } from 'react'
9
9
10
10
import { MotionButtonBase } from '~/components/ui/button'
11
+ import { RelativeTime } from '~/components/ui/relative-time'
11
12
import { BottomToUpTransitionView } from '~/components/ui/transition/BottomToUpTransitionView'
12
13
import { TextUpTransitionView } from '~/components/ui/transition/TextUpTransitionView'
13
14
import { isSupportIcon , SocialIcon } from '~/components/widgets/home/SocialIcon'
15
+ import { PeekLink } from '~/components/widgets/peek/PeekLink'
14
16
import { PostMetaBar } from '~/components/widgets/post'
15
17
import { softBouncePrest , softSpringPreset } from '~/constants/spring'
16
18
import { useConfig } from '~/hooks/data/use-config'
@@ -70,18 +72,27 @@ export default function Home() {
70
72
}
71
73
const TwoColumnLayout = ( {
72
74
children,
75
+ leftContainerClassName,
76
+ rightContainerClassName,
73
77
} : {
74
78
children :
75
79
| [ React . ReactNode , React . ReactNode ]
76
80
| [ React . ReactNode , React . ReactNode , React . ReactNode ]
81
+
82
+ leftContainerClassName ?: string
83
+ rightContainerClassName ?: string
77
84
} ) => {
78
85
return (
79
86
< div className = "relative flex h-full w-full flex-col flex-wrap items-center lg:flex-row" >
80
87
{ children . slice ( 0 , 2 ) . map ( ( child , i ) => {
81
88
return (
82
89
< div
83
90
key = { i }
84
- className = "flex h-1/2 w-full flex-col center lg:h-auto lg:w-1/2"
91
+ className = { clsxm (
92
+ 'flex h-1/2 w-full flex-col center lg:h-auto lg:w-1/2' ,
93
+
94
+ i === 0 ? leftContainerClassName : rightContainerClassName ,
95
+ ) }
85
96
>
86
97
< div className = "relative max-w-full lg:max-w-xl " > { child } </ div >
87
98
</ div >
@@ -197,8 +208,8 @@ const Welcome = () => {
197
208
const PostScreen = ( ) => {
198
209
const { posts } = useHomeQueryData ( )
199
210
return (
200
- < Screen >
201
- < TwoColumnLayout >
211
+ < Screen className = "h-[120vh]" >
212
+ < TwoColumnLayout leftContainerClassName = "h-1/4 lg:h-1/2" >
202
213
< m . h2
203
214
initial = { {
204
215
opacity : 0.0001 ,
@@ -303,15 +314,76 @@ const PostScreen = () => {
303
314
304
315
const NoteScreen = ( ) => {
305
316
const { notes } = useHomeQueryData ( )
317
+ const theLast = notes [ 0 ]
318
+
319
+ const hasHistory = notes . length > 1
320
+
321
+ const history = hasHistory ? notes . slice ( 1 ) : [ ]
322
+
323
+ if ( ! theLast ) return null
306
324
return (
307
325
< Screen >
308
- < TwoColumnLayout >
326
+ < TwoColumnLayout leftContainerClassName = "block lg:flex" >
309
327
< div >
310
- < ul >
311
- { notes . map ( ( note ) => {
312
- return < li key = { note . id } > { note . title } </ li >
313
- } ) }
314
- </ ul >
328
+ < section className = "flex flex-col justify-end" >
329
+ < h3 className = "mb-6 text-center text-xl" >
330
+ 看看我的近况,这是我最近的所思所想
331
+ </ h3 >
332
+ < div
333
+ className = { clsx (
334
+ 'relative flex h-[150px] w-full rounded-md ring-1 ring-slate-200 center dark:ring-neutral-800' ,
335
+ 'hover:shadow-md hover:shadow-slate-100 dark:hover:shadow-neutral-900' ,
336
+ ) }
337
+ >
338
+ < Link href = { routeBuilder ( Routes . Note , { id : theLast . nid } ) } >
339
+ < div className = "absolute bottom-6 right-6 " >
340
+ < h4 className = "font-2xl text-lg font-medium " >
341
+ { theLast . title }
342
+ </ h4 >
343
+
344
+ < small className = "mt-1 block w-full text-right" >
345
+ < RelativeTime date = { theLast . created } />
346
+ </ small >
347
+ </ div >
348
+ </ Link >
349
+
350
+ { ! ! theLast . images ?. [ 0 ] ?. src && (
351
+ < div
352
+ className = "absolute inset-0 bg-cover bg-center"
353
+ style = { {
354
+ background : `url(${ theLast . images [ 0 ] . src } )` ,
355
+ } }
356
+ />
357
+ ) }
358
+ </ div >
359
+ </ section >
360
+
361
+ { hasHistory && (
362
+ < section className = "mt-[20%]" >
363
+ < div className = "text-lg opacity-80" > 这里还有一些历史回顾</ div >
364
+ < ul className = "shiro-timeline mt-4" >
365
+ { history . map ( ( note ) => {
366
+ return (
367
+ < li key = { note . id } className = "flex min-w-0 justify-between" >
368
+ < PeekLink
369
+ className = "min-w-0 flex-shrink truncate"
370
+ href = { routeBuilder ( Routes . Note , { id : note . nid } ) }
371
+ >
372
+ { note . title }
373
+ </ PeekLink >
374
+
375
+ < span className = "ml-2 flex-shrink-0 self-end text-xs opacity-70" >
376
+ < RelativeTime
377
+ date = { note . created }
378
+ displayAbsoluteTimeAfterDay = { 180 }
379
+ />
380
+ </ span >
381
+ </ li >
382
+ )
383
+ } ) }
384
+ </ ul >
385
+ </ section >
386
+ ) }
315
387
</ div >
316
388
< h2 className = "text-2xl font-medium leading-loose" >
317
389
而在这里,你会看到一个不同的我,
0 commit comments