@@ -24,13 +24,17 @@ const IconDisplay = defineComponent({
2424 data ( ) {
2525 return {
2626 theme : ThemeType . Outlined ,
27+ searchVal : '' ,
28+ searchBarAffixed : false ,
2729 } ;
2830 } ,
2931 methods : {
3032 handleChangeTheme ( e ) {
3133 this . theme = e . target . value ;
3234 } ,
33-
35+ handleAffixChange ( affixed ) {
36+ this . searchBarAffixed = affixed ;
37+ } ,
3438 renderCategories ( ) {
3539 const { theme } = this ;
3640
@@ -42,7 +46,10 @@ const IconDisplay = defineComponent({
4246 category : key ,
4347 icons : iconList
4448 . map ( iconName => iconName + theme )
45- . filter ( iconName => allIcons [ iconName ] ) ,
49+ . filter ( iconName => {
50+ if ( iconName . toLowerCase ( ) . includes ( this . searchVal . trim ( ) . toLowerCase ( ) ) )
51+ return allIcons [ iconName ] ;
52+ } ) ,
4653 } ;
4754 } )
4855 . filter ( ( { icons } ) => ! ! icons . length )
@@ -62,18 +69,31 @@ const IconDisplay = defineComponent({
6269 return (
6370 < div >
6471 < h3 style = "margin: 1.6em 0 .6em;" > { this . $t ( 'app.docs.components.icon.pick-theme' ) } </ h3 >
65- < a-radio-group value = { this . theme } onChange = { this . handleChangeTheme } >
66- < a-radio-button value = { ThemeType . Outlined } >
67- < Icon component = { OutlinedIcon } /> { this . $t ( 'app.docs.components.icon.outlined' ) }
68- </ a-radio-button >
69- < a-radio-button value = { ThemeType . Filled } >
70- < Icon component = { FilledIcon } /> { this . $t ( 'app.docs.components.icon.filled' ) }
71- </ a-radio-button >
72- < a-radio-button value = { ThemeType . TwoTone } >
73- < Icon component = { TwoToneIcon } /> { this . $t ( 'app.docs.components.icon.two-tone' ) }
74- </ a-radio-button >
75- </ a-radio-group >
76- { this . renderCategories ( ) }
72+ < a-affix offset-top = { 32 } onChange = { this . handleAffixChange } >
73+ < div class = { this . searchBarAffixed ? 'icons-affix icons-affixed' : 'icons-affix' } >
74+ < a-radio-group value = { this . theme } onChange = { this . handleChangeTheme } >
75+ < a-radio-button value = { ThemeType . Outlined } >
76+ < Icon component = { OutlinedIcon } /> { this . $t ( 'app.docs.components.icon.outlined' ) }
77+ </ a-radio-button >
78+ < a-radio-button value = { ThemeType . Filled } >
79+ < Icon component = { FilledIcon } /> { this . $t ( 'app.docs.components.icon.filled' ) }
80+ </ a-radio-button >
81+ < a-radio-button value = { ThemeType . TwoTone } >
82+ < Icon component = { TwoToneIcon } /> { this . $t ( 'app.docs.components.icon.two-tone' ) }
83+ </ a-radio-button >
84+ </ a-radio-group >
85+ < a-input-search
86+ style = "flex: 1 1 0%; margin-inline-start: 16px;"
87+ placeholder = { this . $t ( 'app.docs.components.icon.search.placeholder' ) }
88+ v-model :value = { this . searchVal }
89+ />
90+ </ div >
91+ </ a-affix >
92+ { this . renderCategories ( ) . length === 0 ? (
93+ < a-empty style = "padding: 12px 0;" />
94+ ) : (
95+ this . renderCategories ( )
96+ ) }
7797 </ div >
7898 ) ;
7999 } ,
0 commit comments