feat: support upload image
This commit is contained in:
parent
ae70d2fee1
commit
5dc3658e19
37 changed files with 1674 additions and 33 deletions
31
app/components/base/icons/IconBase.tsx
Normal file
31
app/components/base/icons/IconBase.tsx
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { forwardRef } from 'react'
|
||||
import { generate } from './utils'
|
||||
import type { AbstractNode } from './utils'
|
||||
|
||||
export type IconData = {
|
||||
name: string
|
||||
icon: AbstractNode
|
||||
}
|
||||
|
||||
export type IconBaseProps = {
|
||||
data: IconData
|
||||
className?: string
|
||||
onClick?: React.MouseEventHandler<SVGElement>
|
||||
style?: React.CSSProperties
|
||||
}
|
||||
|
||||
const IconBase = forwardRef<React.MutableRefObject<HTMLOrSVGElement>, IconBaseProps>((props, ref) => {
|
||||
const { data, className, onClick, style, ...restProps } = props
|
||||
|
||||
return generate(data.icon, `svg-${data.name}`, {
|
||||
className,
|
||||
onClick,
|
||||
style,
|
||||
'data-icon': data.name,
|
||||
'aria-hidden': 'true',
|
||||
...restProps,
|
||||
'ref': ref,
|
||||
})
|
||||
})
|
||||
|
||||
export default IconBase
|
||||
Loading…
Add table
Add a link
Reference in a new issue