import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import cx from "classnames";
import { injectIntl } from "react-intl";
import { simplifyText } from "@gooddata/util";
function CoreHeaderWorkspacePickerItem({ intl, workspaceId, title, isLoading, isSelected, isDemo, onClick, }) {
    const t = intl.formatMessage;
    if (isLoading) {
        return (_jsx("div", { className: "gd-list-item gd-project-list-item gd-is-loading", children: _jsx("div", { className: "gd-spinner small" }) }));
    }
    const classes = cx({
        "gd-list-item": true,
        "gd-project-list-item": true,
        [`s-${simplifyText(title)}`]: true,
        "gd-is-selected": isSelected,
        "gd-is-demo": isDemo,
    });
    const workspaceTitle = title || workspaceId;
    return (_jsxs("button", { className: classes, title: workspaceTitle, onClick: onClick, tabIndex: -1, children: [
            _jsx("span", { className: "project-title", children: workspaceTitle }), isDemo ? (_jsx("span", { className: "demo-sticker", children: t({ id: "gs.header.projectPicker.demo" }) })) : null] }));
}
export const HeaderWorkspacePickerItem = injectIntl(CoreHeaderWorkspacePickerItem);
