diff --git a/ui/v2/src/App.tsx b/ui/v2/src/App.tsx index 89c30b2b8d0..bf66dfa3824 100755 --- a/ui/v2/src/App.tsx +++ b/ui/v2/src/App.tsx @@ -1,4 +1,4 @@ -import React, { FunctionComponent, useEffect } from "react"; +import React, { FunctionComponent, useState } from "react"; import { Route, Switch } from "react-router-dom"; import { ErrorBoundary } from "./components/ErrorBoundary"; import Galleries from "./components/Galleries/Galleries"; @@ -11,26 +11,80 @@ import { Stats } from "./components/Stats"; import Studios from "./components/Studios/Studios"; import Tags from "./components/Tags/Tags"; import { SceneFilenameParser } from "./components/scenes/SceneFilenameParser"; +import { Sidebar } from "./components/Sidebar"; +import { IconName } from "@blueprintjs/core"; + +export interface IMenuItem { + icon: IconName + text: string + href: string +} interface IProps {} export const App: FunctionComponent = (props: IProps) => { + const [menuOpen, setMenuOpen] = useState(false); + + function getSidebarClosedClass() { + if (!menuOpen) { + return " sidebar-closed"; + } + + return ""; + } + + const menuItems: IMenuItem[] = [ + { + icon: "video", + text: "Scenes", + href: "/scenes" + }, + { + href: "/scenes/markers", + icon: "map-marker", + text: "Markers" + }, + { + href: "/galleries", + icon: "media", + text: "Galleries" + }, + { + href: "/performers", + icon: "person", + text: "Performers" + }, + { + href: "/studios", + icon: "mobile-video", + text: "Studios" + }, + { + href: "/tags", + icon: "tag", + text: "Tags" + } + ]; + return (
- - - - - {/* */} - - - - - - - - + setMenuOpen(!menuOpen)} menuItems={menuItems}/> + +
+ + + + {/* */} + + + + + + + + +
); diff --git a/ui/v2/src/components/MainNavbar.tsx b/ui/v2/src/components/MainNavbar.tsx index fbe1dd08825..3c9d6b8c9d6 100644 --- a/ui/v2/src/components/MainNavbar.tsx +++ b/ui/v2/src/components/MainNavbar.tsx @@ -3,12 +3,17 @@ import { NavbarDivider, NavbarGroup, NavbarHeading, + Button, } from "@blueprintjs/core"; import React, { FunctionComponent, useEffect, useState } from "react"; import { Link, NavLink } from "react-router-dom"; import useLocation from "react-use/lib/useLocation"; +import { IMenuItem } from "../App"; -interface IProps {} +interface IProps { + onMenuToggle() : void + menuItems: IMenuItem[] +} export const MainNavbar: FunctionComponent = (props) => { const [newButtonPath, setNewButtonPath] = useState(undefined); @@ -46,76 +51,38 @@ export const MainNavbar: FunctionComponent = (props) => { } return ( - -
- - Stash - + <> + +
+ +
-
+ {props.menuItems.map((i) => { + return ( + + {i.text} + + ); + })} +
+ + {renderNewButton()} + + +
+
+ ); }; diff --git a/ui/v2/src/components/Sidebar.tsx b/ui/v2/src/components/Sidebar.tsx new file mode 100644 index 00000000000..63ba8c5002c --- /dev/null +++ b/ui/v2/src/components/Sidebar.tsx @@ -0,0 +1,32 @@ +import { + MenuItem, + Menu, + IconName, +} from "@blueprintjs/core"; +import React, { FunctionComponent } from "react"; +import { IMenuItem } from "../App"; + +interface IProps { + className: string + menuItems: IMenuItem[] +} + +export const Sidebar: FunctionComponent = (props) => { + return ( + <> +
+ + {props.menuItems.map((i) => { + return ( + + ) + })} + +
+ + ); +}; diff --git a/ui/v2/src/index.scss b/ui/v2/src/index.scss index 48ec7f917b9..8e61e211e43 100755 --- a/ui/v2/src/index.scss +++ b/ui/v2/src/index.scss @@ -476,4 +476,50 @@ span.block { .aliases-field > label{ font-weight: 300; -} \ No newline at end of file +} + +@media only screen and (max-width: 768px) { + // collapse menu items into sidemenu + .collapsible-navlink { + display: none; + } +} + + +.sidebar { + position: fixed; + top: 50px; + bottom: 0; + left: 0; + width: 200px; + background-color: #394b59; + transition: left 0.5s; + z-index: 11; +} + +.sidebar.sidebar-closed { + left: -200px; + transition: left 0.5s; +} + +// overlay menu on smaller devices +@media only screen and (min-width: 768px) { + // hide menu button on larger devices + .menu-button { + display: none; + } + + .main { + margin-left: 200px; + transition: margin-left 0.5s; + } + + .sidebar { + left: -200px; + } + + .main.sidebar-closed { + margin-left: 0px; + transition: margin-left 0.5s; + } +}