import { DetailedHTMLProps, HTMLAttributes } from 'react' import VanillaTilt, { TiltOptions } from 'vanilla-tilt' import styles from '@/assets/css/components/tools/repository-card.module.less' import Card from '@/components/common/Card' import FlexBox from '@/components/common/FlexBox' import Draggable from '@/components/dnd/Draggable' import DragHandle from '@/components/dnd/DragHandle' interface RepositoryCardProps extends DetailedHTMLProps, HTMLDivElement> { icon: string toolName: string toolId: string ver: string platform: Platform options?: TiltOptions onOpen?: () => void onEdit?: () => void onSource?: () => void onPublish?: () => void onCancelReview?: () => void onDelete?: () => void } const RepositoryCard = ({ style, ref, icon, toolName, toolId, ver, platform, options = { reverse: true, max: 8, glare: true, ['max-glare']: 0.3, scale: 1.03 }, onOpen, onEdit, onSource, onPublish, onCancelReview, onDelete, children, ...props }: RepositoryCardProps) => { const cardRef = useRef(null) useEffect(() => { cardRef.current && VanillaTilt.init(cardRef.current, options) }, [options]) return ( {children} {toolName} {`ID: ${toolId}`} {onOpen && ( 打开 )} {onEdit && onPublish && ( 编辑 发布 )} {onSource && ( 源码 )} {onCancelReview && ( 取消审核 )} {onDelete && ( 删除 )} ) } export default RepositoryCard