Files
spacedrive/interface/app/$libraryId/settings/Layout.tsx
Brendan Allan 0ef65fce2d [ENG-1423] Multiple tabs (#1777)
* tabs w/ multiple router instances

* fix router switching

* keybinds

* manual history tracking

* eslint

* remove scroll restoration

* fix tab removal

* route title + tab create delay

* typescript

* put tab list up top

* Remove import + show close button only if tabs length more than 1

* lint

* unify blur across whole top bar

* add to keybindings page, tauri drag region, and tooltip

* fix blur

* more drag regions

* merge moment

---------

Co-authored-by: ameer2468 <33054370+ameer2468@users.noreply.github.com>
2023-11-16 15:14:47 +00:00

50 lines
1.3 KiB
TypeScript

import { PropsWithChildren, ReactNode, Suspense } from 'react';
import { Outlet } from 'react-router';
import { useRouteTitle } from '~/hooks';
import { useOperatingSystem } from '~/hooks/useOperatingSystem';
import { useWindowState } from '~/hooks/useWindowState';
import DragRegion from '../../../components/DragRegion';
import Sidebar from './Sidebar';
export const Component = () => {
const os = useOperatingSystem();
const windowState = useWindowState();
useRouteTitle('Settings');
return (
<div className="flex w-full flex-row bg-app">
<Sidebar />
<div className="relative w-full">
<Suspense>
{os === 'macOS' && !windowState.isFullScreen && (
<DragRegion className="absolute inset-x-0 top-0 z-50 h-8" />
)}
<Outlet />
</Suspense>
</div>
</div>
);
};
interface HeaderProps extends PropsWithChildren {
title: string;
description: string | ReactNode;
rightArea?: ReactNode;
}
export const Heading = (props: HeaderProps) => {
return (
<div className="mb-3 flex">
{props.children}
<div className="grow">
<h1 className="text-2xl font-bold">{props.title}</h1>
<p className="mt-1 text-sm text-gray-400">{props.description}</p>
</div>
{props.rightArea}
<hr className="mt-4 border-gray-550" />
</div>
);
};