"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const uikit_1 = require("@gravity-ui/uikit");
const cn_1 = require("../../utils/cn.js");
const defaultIcon_1 = require("./defaultIcon.js");
const b = (0, cn_1.editorCn)('block-card');
const BlockCard = ({ className, type, name, previewImg, onMouseDown }) => {
    const handleMouseDown = React.useCallback(() => {
        onMouseDown(type);
    }, [onMouseDown, type]);
    return ((0, jsx_runtime_1.jsxs)(uikit_1.Card, { className: b(null, className), onMouseDown: handleMouseDown, children: [(0, jsx_runtime_1.jsx)("div", { className: b('image'), children: previewImg ? ((0, jsx_runtime_1.jsx)("img", { className: b('image-img'), src: previewImg, alt: "preview of the block" })) : ((0, jsx_runtime_1.jsx)("img", { className: b('image-img'), src: defaultIcon_1.defaultIcon, alt: "preview of the block" })) }), (0, jsx_runtime_1.jsx)("div", { className: b('name'), children: name })] }));
};
exports.default = BlockCard;
//# sourceMappingURL=BlockCard.js.map
