/* eslint-disable react/require-default-props */

/**
 * 详情页面面包屑
 */

import PropTypes from 'prop-types';
import { Breadcrumbs, Link, Typography, Box, Skeleton } from '@mui/material';
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export default function Breadcrumb({
  org = {},
  loading = false
}) {
  const {
    t,
    locale
  } = useLocaleContext();
  if (!org.id) {
    return null;
  }
  if (loading) {
    return /*#__PURE__*/_jsxs(Box, {
      sx: {
        display: 'flex',
        alignItems: 'center',
        gap: 1
      },
      children: [/*#__PURE__*/_jsx(Skeleton, {
        variant: "text",
        width: 50,
        height: 24
      }), /*#__PURE__*/_jsx(Skeleton, {
        variant: "text",
        width: 20,
        height: 24
      })]
    });
  }
  return /*#__PURE__*/_jsxs(Breadcrumbs, {
    "aria-label": "breadcrumb",
    children: [/*#__PURE__*/_jsx(Link, {
      underline: "hover",
      color: "inherit",
      href: `${WELLKNOWN_SERVICE_PATH_PREFIX}/user/orgs?locale=${locale}`,
      children: t('common.orgs')
    }), /*#__PURE__*/_jsx(Typography, {
      children: org.name
    })]
  });
}
Breadcrumb.propTypes = {
  org: PropTypes.object.isRequired,
  loading: PropTypes.bool
};