header.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 buttonProps={{size: 'sm'}} featureName="widget-builder" />
  53. <Button
  54. external
  55. size="sm"
  56. href="https://docs.sentry.io/product/dashboards/custom-dashboards/#widget-builder"
  57. >
  58. {t('Read the docs')}
  59. </Button>
  60. </ButtonBar>
  61. </Layout.HeaderActions>
  62. </Layout.Header>
  63. );
  64. }