import React from "react";
import { useThemeInternal } from "../../../theme/Theme.js";
import { LinkAnchor } from "../../../utils/components/link-anchor/index.js";
import { downloadFile } from "../helpers/download-file.js";
import { isNativeFile } from "../helpers/file-type-checker.js";
import ItemIcon from "../item-icon/ItemIcon.js";
const ItemHeader = ({ file, href, onClick }) => {
    const ctx = useThemeInternal();
    if (onClick && href) {
        return (React.createElement(LinkAnchor, { href: href, onClick: onClick, className: "aksel-file-item__link", "data-color": ctx.color },
            React.createElement(ItemIcon, { file: file }),
            file.name));
    }
    if (onClick) {
        return (React.createElement(LinkAnchor, { href: "#", onClick: (event) => {
                event.preventDefault();
                onClick(event);
            }, className: "aksel-file-item__link", "data-color": ctx.color },
            React.createElement(ItemIcon, { file: file }),
            file.name));
    }
    if (href) {
        return (React.createElement(LinkAnchor, { href: href, className: "aksel-file-item__link", "data-color": ctx.color },
            React.createElement(ItemIcon, { file: file }),
            file.name));
    }
    if (isNativeFile(file)) {
        return (React.createElement(LinkAnchor, { href: "#", download: file.name, onClick: (event) => {
                event.preventDefault();
                downloadFile(file);
            }, className: "aksel-file-item__link", "data-color": ctx.color },
            React.createElement(ItemIcon, { file: file }),
            file.name));
    }
    return (React.createElement("span", { className: "aksel-file-item__link" },
        React.createElement(ItemIcon, { file: file }),
        file.name));
};
export { ItemHeader };
//# sourceMappingURL=ItemHeader.js.map