| 1 | import type { ForwardedRef } from 'react' |
| 2 | import { forwardRef, memo, useMemo } from 'react' |
| 3 | |
| 4 | export interface IAllPlatIconRef {} |
| 5 | |
| 6 | export interface IAllPlatIconProps { |
| 7 | size?: number |
| 8 | style?: React.CSSProperties |
| 9 | } |
| 10 | |
| 11 | const AllPlatIcon = memo( |
| 12 | forwardRef(({ size = 50, style = {} }: IAllPlatIconProps, ref: ForwardedRef<IAllPlatIconRef>) => { |
| 13 | const widthChild = useMemo(() => { |
| 14 | return size / 5 |
| 15 | }, [size]) |
| 16 | |
| 17 | const childStyle = useMemo(() => { |
| 18 | return { |
| 19 | width: `${widthChild}px`, |
| 20 | height: `${widthChild}px`, |
| 21 | } |
| 22 | }, [widthChild]) |
| 23 | |
| 24 | return ( |
| 25 | <div |
| 26 | className="flex flex-wrap gap-1" |
| 27 | style={{ width: `${size}px`, height: `${size}px`, ...style }} |
| 28 | > |
| 29 | <ul className="flex gap-1 list-none p-0 m-0"> |
| 30 | <li className="bg-muted rounded" style={childStyle}></li> |
| 31 | <li className="bg-muted rounded" style={childStyle}></li> |
| 32 | </ul> |
| 33 | <ul className="flex gap-1 list-none p-0 m-0"> |
| 34 | <li className="bg-muted rounded" style={childStyle}></li> |
| 35 | <li className="bg-muted rounded" style={childStyle}></li> |
| 36 | </ul> |
| 37 | </div> |
| 38 | ) |
| 39 | }), |
| 40 | ) |
| 41 | |
| 42 | export default AllPlatIcon |
| 43 |