✨ feat(组件): 新增 iconCard 组件
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
.iconCard {
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import { View } from "@tarojs/components"
|
||||
import { FC, ReactNode } from "react"
|
||||
import IconFont from "../iconfont"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type IconfontName = Parameters<typeof IconFont>['0']['name']
|
||||
|
||||
interface PropsType {
|
||||
iconName: IconfontName
|
||||
title: string
|
||||
children?: ReactNode
|
||||
onClick?: Function
|
||||
}
|
||||
const IconCard: FC<PropsType> = (props) => {
|
||||
const { iconName, title, onClick } = props
|
||||
const handleClick = (event) => {
|
||||
onClick && onClick(event)
|
||||
}
|
||||
return (
|
||||
<View className={styles.iconCard} onClick={handleClick}>
|
||||
<IconFont name={iconName} size={72}></IconFont>
|
||||
<View>{title}</View>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
export default IconCard
|
||||
Reference in New Issue
Block a user