1- 'use client' ;
2-
3- import Image from 'next/image' ;
4- import Link from 'next/link' ;
5-
61import { 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' ;
96
107export default function Projects ( ) {
8+ const lang = getUserLocale ( ) ;
9+ const projectsLocale = localeValues [ lang ] . projects ;
10+
1111 return (
1212 < div >
1313 < header className = "prose prose-p:my-2 font-mono" >
1414 < h1 className = " flex items-center" >
15- 项目
15+ { projectsLocale . projects }
1616 < a
17- href = { ` https://github.com/coderz-w` }
17+ href = " https://github.com/coderz-w"
1818 className = "ml-2 inline-flex !text-inherit"
1919 target = "_blank"
2020 aria-label = "view on GitHub"
@@ -31,63 +31,3 @@ export default function Projects() {
3131 </ div >
3232 ) ;
3333}
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