Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split "manage single video" page into multiple pages #595

Merged
Merged
18 changes: 11 additions & 7 deletions frontend/src/layout/Burger.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { ReactNode } from "react";


type BurgerMenuProps = {
hide: () => void;
children: ReactNode;
items: [] | [JSX.Element] | [JSX.Element, JSX.Element];
};

export const BurgerMenu: React.FC<BurgerMenuProps> = ({ hide, children }) => (
export const BurgerMenu: React.FC<BurgerMenuProps> = ({ hide, items }) => (
<div
onClick={e => {
if (e.target === e.currentTarget) {
Expand Down Expand Up @@ -35,11 +32,18 @@ export const BurgerMenu: React.FC<BurgerMenuProps> = ({ hide, children }) => (
width: "clamp(260px, 75%, 450px)",
overflowY: "auto",
borderTop: "1px solid var(--grey80)",
gap: 16,
"& > *:first-child": {
borderBottom: "1px solid var(--grey80)",
borderBottom: "1px dashed var(--grey80)",
},
"& > *:last-child": {
borderTop: "1px dashed var(--grey80)",
},
}}>
{children}
{items.length > 0 && <div>{items[0]}</div>}
{items.length > 1 && <>
<div>{items[1]}</div>
</>}
</div>
</div>
);
6 changes: 2 additions & 4 deletions frontend/src/layout/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ type Props = {

export const Root: React.FC<Props> = ({ nav, children }) => {
const menu = useMenu();
const navElements = Array.isArray(nav) ? nav : [nav];
const navElements = Array.isArray(nav) ? nav : [nav] as [JSX.Element];
JulianKniephoff marked this conversation as resolved.
Show resolved Hide resolved
const navExists = navElements.length > 0;

return (
<Outer disableScrolling={menu.state === "burger"}>
<Header hideNavIcon={!navExists} />
{menu.state === "burger" && navExists && (
<BurgerMenu hide={() => menu.close()}>
{navElements.map((elem, i) => <div key={i}>{elem}</div>)}
</BurgerMenu>
<BurgerMenu items={navElements} hide={() => menu.close()} />
)}
<div css={{ margin: OUTER_CONTAINER_MARGIN }}>
<div css={{
Expand Down