1
- 'use client' ;
2
-
3
- import Image from 'next/image' ;
4
- import Link from 'next/link' ;
5
-
6
1
import { GitHubBrandIcon } from '@/components/icons/platform/GitHubBrandIcon' ;
7
- import { cn } from '@/lib/helper' ;
8
- import { ProjectModel , projectList } from '~/index' ;
2
+ import { ProjectCardList } from '@/components/modules/projects/ProjectCardList' ;
3
+ import { projectList } from '~/index' ;
4
+ import { getUserLocale } from '@/lib/getLocale' ;
5
+ import localeValues from '@/locale' ;
9
6
10
7
export default function Projects ( ) {
8
+ const lang = getUserLocale ( ) ;
9
+ const projectsLocale = localeValues [ lang ] . projects ;
10
+
11
11
return (
12
12
< div >
13
13
< header className = "prose prose-p:my-2 font-mono" >
14
14
< h1 className = " flex items-center" >
15
- 项目
15
+ { projectsLocale . projects }
16
16
< a
17
- href = { ` https://github.com/coderz-w` }
17
+ href = " https://github.com/coderz-w"
18
18
className = "ml-2 inline-flex !text-inherit"
19
19
target = "_blank"
20
20
aria-label = "view on GitHub"
@@ -31,63 +31,3 @@ export default function Projects() {
31
31
</ div >
32
32
) ;
33
33
}
34
-
35
- const ProjectCardList = ( { data } : { data : ProjectModel [ ] } ) => (
36
- < div className = "grid min-w-0 grid-cols-2 gap-6 lg:grid-cols-3" >
37
- { data . map ( ( projectModel ) => {
38
- return < ProjectCard key = { projectModel . name } project = { projectModel } /> ;
39
- } ) }
40
- </ div >
41
- ) ;
42
- const ProjectCard = ( { project } : { project : ProjectModel } ) => {
43
- return (
44
- < Link
45
- href = { project . url }
46
- key = { project . id }
47
- className = "group flex shrink-0 grid-cols-[60px_2fr] flex-col items-center gap-4 md:grid"
48
- >
49
- < ProjectIcon
50
- className = "size-16 group-hover:-translate-y-2 group-hover:shadow-out-sm md:size-auto"
51
- avatar = { project . avatar }
52
- name = { project . name }
53
- />
54
- < span className = "flex shrink-0 grow flex-col gap-2 text-left" >
55
- < h2 className = "m-0 text-balance p-0 text-center font-medium md:text-left" >
56
- { project . name }
57
- </ h2 >
58
- < span className = "line-clamp-5 text-balance text-center text-sm md:line-clamp-4 md:text-left lg:line-clamp-2" >
59
- { project . desc }
60
- </ span >
61
- </ span >
62
- </ Link >
63
- ) ;
64
- } ;
65
-
66
- const ProjectIcon = ( props : { avatar ?: string ; name ?: string ; className ?: string } ) => {
67
- const { avatar, name, className } = props ;
68
-
69
- return (
70
- < div
71
- className = { cn (
72
- 'project-icon flex shrink-0 grow items-center justify-center' ,
73
- avatar
74
- ? 'ring-2 ring-slate-200 dark:ring-neutral-800'
75
- : 'bg-slate-300 text-white dark:bg-neutral-800 text-3xl' ,
76
- 'mask mask-squircle aspect-square transition-all duration-300' ,
77
- className ,
78
- ) }
79
- >
80
- { avatar ? (
81
- < Image
82
- src = { avatar }
83
- height = { 64 }
84
- width = { 64 }
85
- alt = { `Avatar of ${ name } ` }
86
- className = " rounded-xl duration-300 transition-all aspect-square"
87
- />
88
- ) : (
89
- < > { name ?. charAt ( 0 ) . toUpperCase ( ) || '' } </ >
90
- ) }
91
- </ div >
92
- ) ;
93
- } ;
0 commit comments