1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import DocumentTitle from 'react-document-title';
- type Props = {
- children?: React.ReactChild;
-
- noSuffix?: boolean;
-
- orgSlug?: string;
-
- projectSlug?: string;
-
- title?: string;
- };
- function SentryDocumentTitle({
- title = '',
- orgSlug,
- projectSlug,
- noSuffix,
- children,
- }: Props) {
- function getPageTitle() {
- if (orgSlug && projectSlug) {
- return `${title} - ${orgSlug} - ${projectSlug}`;
- }
- if (orgSlug) {
- return `${title} - ${orgSlug}`;
- }
- if (projectSlug) {
- return `${title} - ${projectSlug}`;
- }
- return title;
- }
- const pageTitle = getPageTitle();
- const documentTitle = noSuffix
- ? pageTitle
- : pageTitle !== ''
- ? `${pageTitle} - Sentry`
- : 'Sentry';
- return <DocumentTitle title={documentTitle}>{children}</DocumentTitle>;
- }
- export default SentryDocumentTitle;
|