import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { Card } from '@gravity-ui/uikit';
import { editorCn } from "../../utils/cn.js";
import { defaultIcon } from "./defaultIcon.js";
import './BlockCard.css';
const b = editorCn('block-card');
const BlockCard = ({ className, type, name, previewImg, onMouseDown }) => {
    const handleMouseDown = React.useCallback(() => {
        onMouseDown(type);
    }, [onMouseDown, type]);
    return (_jsxs(Card, { className: b(null, className), onMouseDown: handleMouseDown, children: [_jsx("div", { className: b('image'), children: previewImg ? (_jsx("img", { className: b('image-img'), src: previewImg, alt: "preview of the block" })) : (_jsx("img", { className: b('image-img'), src: defaultIcon, alt: "preview of the block" })) }), _jsx("div", { className: b('name'), children: name })] }));
};
export default BlockCard;
//# sourceMappingURL=BlockCard.js.map
