header.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import Breadcrumbs from 'sentry/components/breadcrumbs';
  2. import Button from 'sentry/components/button';
  3. import ButtonBar from 'sentry/components/buttonBar';
  4. import EditableText from 'sentry/components/editableText';
  5. import {FeatureFeedback} from 'sentry/components/featureFeedback';
  6. import * as Layout from 'sentry/components/layouts/thirds';
  7. import type {LinkProps} from 'sentry/components/links/link';
  8. import {t} from 'sentry/locale';
  9. import {DashboardDetails} from '../types';
  10. interface Props {
  11. dashboardTitle: DashboardDetails['title'];
  12. goBackLocation: LinkProps['to'];
  13. onChangeTitle: (title: string) => void;
  14. orgSlug: string;
  15. title: string;
  16. }
  17. export function Header({
  18. title,
  19. orgSlug,
  20. goBackLocation,
  21. dashboardTitle,
  22. onChangeTitle,
  23. }: Props) {
  24. return (
  25. <Layout.Header>
  26. <Layout.HeaderContent>
  27. <Breadcrumbs
  28. crumbs={[
  29. {
  30. to: `/organizations/${orgSlug}/dashboards/`,
  31. label: t('Dashboards'),
  32. },
  33. {
  34. to: goBackLocation,
  35. label: dashboardTitle,
  36. },
  37. {label: t('Widget Builder')},
  38. ]}
  39. />
  40. <Layout.Title>
  41. <EditableText
  42. aria-label={t('Widget title')}
  43. value={title}
  44. onChange={onChangeTitle}
  45. errorMessage={t('Widget title is required')}
  46. maxLength={255}
  47. />
  48. </Layout.Title>
  49. </Layout.HeaderContent>
  50. <Layout.HeaderActions>
  51. <ButtonBar gap={1}>
  52. <FeatureFeedback featureName="widget-builder" />
  53. <Button
  54. external
  55. href="https://docs.sentry.io/product/dashboards/custom-dashboards/#widget-builder"
  56. >
  57. {t('Read the docs')}
  58. </Button>
  59. </ButtonBar>
  60. </Layout.HeaderActions>
  61. </Layout.Header>
  62. );
  63. }