11import React , { useMemo } from 'react' ;
22import './home.scss' ;
33import { useNavigate } from 'react-router-dom' ;
4- import { Button , Icon , Flex , Typography , Statistic , Card , Row , Col } from '@tiny-design/react' ;
4+ import { Button , Flex , Typography , Statistic , Card , Row , Col } from '@tiny-design/react' ;
5+ import {
6+ IconColorlens , IconOrgUnit , IconPuzzle , IconAccessible ,
7+ IconStar , IconStructure , IconProcess , IconEye , IconEditFile , IconFeedback ,
8+ IconGithub ,
9+ } from '@tiny-design/icons' ;
10+ import type { IconProps } from '@tiny-design/icons' ;
511import { Footer } from './footer' ;
612import { useLocaleContext } from '../../context/locale-context' ;
713import { getComponentMenu } from '../../routers' ;
@@ -15,20 +21,20 @@ const HomePage = (): React.ReactElement => {
1521 const navigate = useNavigate ( ) ;
1622 const { siteLocale : s } = useLocaleContext ( ) ;
1723
18- const features = [
19- { icon : 'colorlens' , title : s . home . features . themeable , desc : s . home . features . themeableDesc } ,
20- { icon : 'org-unit' , title : s . home . features . elegant , desc : s . home . features . elegantDesc } ,
21- { icon : 'puzzle' , title : s . home . features . composable , desc : s . home . features . composableDesc } ,
22- { icon : 'accessible' , title : s . home . features . accessible , desc : s . home . features . accessibleDesc } ,
24+ const features : { Icon : React . FC < IconProps > ; title : string ; desc : string } [ ] = [
25+ { Icon : IconColorlens , title : s . home . features . themeable , desc : s . home . features . themeableDesc } ,
26+ { Icon : IconOrgUnit , title : s . home . features . elegant , desc : s . home . features . elegantDesc } ,
27+ { Icon : IconPuzzle , title : s . home . features . composable , desc : s . home . features . composableDesc } ,
28+ { Icon : IconAccessible , title : s . home . features . accessible , desc : s . home . features . accessibleDesc } ,
2329 ] ;
2430
25- const categoryIcons = [ 'star' , 'structure' , 'process' , 'eye' , 'edit-file' , 'feedback' , 'puzzle' ] ;
31+ const categoryIcons : React . FC < IconProps > [ ] = [ IconStar , IconStructure , IconProcess , IconEye , IconEditFile , IconFeedback , IconPuzzle ] ;
2632
2733 const { stats, categories } = useMemo ( ( ) => {
2834 const menu = getComponentMenu ( s ) ;
2935 const totalComponents = menu . reduce ( ( sum , cat ) => sum + ( cat . children ?. length ?? 0 ) , 0 ) ;
3036 const cats = menu . map ( ( cat , i ) => ( {
31- icon : categoryIcons [ i ] ?? 'puzzle' ,
37+ Icon : categoryIcons [ i ] ?? IconPuzzle ,
3238 name : cat . title ,
3339 count : cat . children ?. length ?? 0 ,
3440 route : cat . children ?. [ 0 ] ?. route ?? '' ,
@@ -68,7 +74,7 @@ const HomePage = (): React.ReactElement => {
6874 < Button
6975 className = "home__btn"
7076 size = "lg"
71- icon = { < Icon name = "github" color = "currentColor" /> }
77+ icon = { < IconGithub color = "currentColor" /> }
7278 onClick = { ( ) => window . open ( repository . url ) } >
7379 { s . home . github }
7480 </ Button >
@@ -83,7 +89,7 @@ const HomePage = (): React.ReactElement => {
8389 < Card bordered = { false } className = "home__feature-card" style = { { animationDelay : `${ i * 0.1 } s` } } >
8490 < Flex vertical align = "center" gap = "md" >
8591 < div className = "home__feature-icon" >
86- < Icon name = { feature . icon } size = { 24 } />
92+ < feature . Icon size = { 24 } />
8793 </ div >
8894 < Typography . Heading level = { 3 } > { feature . title } </ Typography . Heading >
8995 < Typography . Paragraph > { feature . desc } </ Typography . Paragraph >
@@ -111,7 +117,7 @@ const HomePage = (): React.ReactElement => {
111117 onClick = { ( ) => navigate ( `/components/${ cat . route } ` ) }
112118 style = { { animationDelay : `${ i * 0.08 } s` } } >
113119 < Flex vertical align = "center" gap = "sm" >
114- < Icon name = { cat . icon } size = { 32 } color = "currentColor" />
120+ < cat . Icon size = { 32 } color = "currentColor" />
115121 < Typography . Text strong > { cat . name } </ Typography . Text >
116122 < Typography . Text className = "home__category-count" > { s . home . nComponents ( cat . count ) } </ Typography . Text >
117123 </ Flex >
0 commit comments