1- import React from 'react'
1+ import { FC , memo } from 'react'
22import T from 'prop-types'
33
44import { ICON } from '@/config'
55import { cutRest } from '@/utils'
6+ import type { TOption } from './index'
67
78import {
89 Wrapper ,
@@ -37,7 +38,13 @@ const LinkBlock = ({ children, link }) => {
3738 )
3839}
3940
40- const OptionPanel = ( { options, onClick, panelMinWidth } ) => {
41+ type TProps = {
42+ options : TOption [ ]
43+ panelMinWidth : string
44+ onClick ?: ( key ?: string ) => void
45+ }
46+
47+ const OptionPanel : FC < TProps > = ( { options, onClick, panelMinWidth } ) => {
4148 return (
4249 < Wrapper panelMinWidth = { panelMinWidth } >
4350 { options . map ( ( item , index ) => (
@@ -49,7 +56,7 @@ const OptionPanel = ({ options, onClick, panelMinWidth }) => {
4956 { /* common_check icon is special, smaller than normal icons,
5057 and check icon is always the first icon */ }
5158 < IconWrapper >
52- < Icon src = { item . icon } index = { index } bigger = { index === 0 } />
59+ < Icon src = { item . icon } index = { index } />
5360 </ IconWrapper >
5461 < Intro >
5562 < Header >
@@ -64,22 +71,4 @@ const OptionPanel = ({ options, onClick, panelMinWidth }) => {
6471 )
6572}
6673
67- OptionPanel . propTypes = {
68- onClick : T . func ,
69- options : T . arrayOf (
70- T . shape ( {
71- title : T . stirng ,
72- desc : T . string ,
73- icon : T . string ,
74- link : T . string ,
75- } ) ,
76- ) ,
77- panelMinWidth : T . string . isRequired ,
78- }
79-
80- OptionPanel . defaultProps = {
81- options : [ ] ,
82- onClick : console . log ,
83- }
84-
85- export default React . memo ( OptionPanel )
74+ export default memo ( OptionPanel )
0 commit comments