|
| 1 | +/* |
| 2 | + * SonarQube |
| 3 | + * Copyright (C) 2009-2025 SonarSource Sàrl |
| 4 | + * mailto:info AT sonarsource DOT com |
| 5 | + * |
| 6 | + * This program is free software; you can redistribute it and/or |
| 7 | + * modify it under the terms of the GNU Lesser General Public |
| 8 | + * License as published by the Free Software Foundation; either |
| 9 | + * version 3 of the License, or (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | + * Lesser General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Lesser General Public License |
| 17 | + * along with this program; if not, write to the Free Software Foundation, |
| 18 | + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | + */ |
| 20 | + |
| 21 | +import { BreadcrumbsProps, Layout, PageGridProps } from '@sonarsource/echoes-react'; |
| 22 | +import classNames from 'classnames'; |
| 23 | +import { forwardRef, PropsWithChildren, ReactNode } from 'react'; |
| 24 | +import { Helmet } from 'react-helmet-async'; |
| 25 | +import { useFullWindow } from '~shared/context/fullWindowContext'; |
| 26 | +import { GlobalFooter } from './GlobalFooter'; |
| 27 | + |
| 28 | +interface Props extends PropsWithChildren { |
| 29 | + actions?: ReactNode; |
| 30 | + asideLeft?: ReactNode; |
| 31 | + breadcrumbs?: BreadcrumbsProps['items']; |
| 32 | + header?: ReactNode; |
| 33 | + legacyContentHeader?: ReactNode; |
| 34 | + metadata?: ReactNode; |
| 35 | + title: string; |
| 36 | + width?: PageGridProps['width']; |
| 37 | +} |
| 38 | + |
| 39 | +export const ArchitecturePageTemplate = forwardRef<HTMLDivElement, Readonly<Props>>( |
| 40 | + (props, ref) => { |
| 41 | + const { asideLeft, children, header, legacyContentHeader, title, width = 'default' } = props; |
| 42 | + const { fullWindow } = useFullWindow(); |
| 43 | + |
| 44 | + // This will need to be reworked when we migrate SQS to the new layout with sidebar navigation and architecture is actually available on SQS too. |
| 45 | + |
| 46 | + return ( |
| 47 | + <> |
| 48 | + <Helmet defer={false} title={title} /> |
| 49 | + |
| 50 | + {asideLeft} |
| 51 | + {legacyContentHeader} |
| 52 | + |
| 53 | + <Layout.PageGrid ref={ref} width={width}> |
| 54 | + {header} |
| 55 | + |
| 56 | + <Layout.PageContent className={classNames({ 'sw-p-0': fullWindow })}> |
| 57 | + {children} |
| 58 | + </Layout.PageContent> |
| 59 | + |
| 60 | + <GlobalFooter /> |
| 61 | + </Layout.PageGrid> |
| 62 | + </> |
| 63 | + ); |
| 64 | + }, |
| 65 | +); |
| 66 | + |
| 67 | +ArchitecturePageTemplate.displayName = 'ArchitecturePageTemplate'; |
0 commit comments