argo-cd
1import * as React from 'react';
2import {Sidebar} from '../../../sidebar/sidebar';
3import {ViewPreferences} from '../../services';
4
5require('./layout.scss');
6
7export interface LayoutProps {
8navItems: Array<{path: string; iconClassName: string; title: string}>;
9onVersionClick?: () => void;
10children?: React.ReactNode;
11pref: ViewPreferences;
12isExtension?: boolean;
13}
14
15const getBGColor = (theme: string): string => (theme === 'light' ? '#dee6eb' : '#100f0f');
16
17export const Layout = (props: LayoutProps) => {
18React.useEffect(() => {
19if (props.pref.theme) {
20document.body.style.background = getBGColor(props.pref.theme);
21}
22}, [props.pref.theme]);
23
24return (
25<div className={props.pref.theme ? 'theme-' + props.pref.theme : 'theme-light'}>
26<div className={`cd-layout ${props.isExtension ? 'cd-layout--extension' : ''}`}>
27<Sidebar onVersionClick={props.onVersionClick} navItems={props.navItems} pref={props.pref} />
28<div className={`cd-layout__content ${props.pref.hideSidebar ? 'cd-layout__content--sb-collapsed' : 'cd-layout__content--sb-expanded'} custom-styles`}>
29{props.children}
30</div>
31</div>
32</div>
33);
34};
35