From 57ecb5dff552a0d01601560c5535c2583ff801f6 Mon Sep 17 00:00:00 2001 From: viktorstrate Date: Fri, 21 May 2021 15:12:10 +0200 Subject: [PATCH] Work on desktop view --- ui/src/components/header/Header.tsx | 10 +- ui/src/components/header/Searchbar.tsx | 2 +- ui/src/components/layout/Layout.tsx | 188 +------------------- ui/src/components/layout/MainMenu.tsx | 159 +++++++++++++++++ ui/src/components/layout/icons/mountain.svg | 15 -- 5 files changed, 174 insertions(+), 200 deletions(-) create mode 100644 ui/src/components/layout/MainMenu.tsx delete mode 100644 ui/src/components/layout/icons/mountain.svg diff --git a/ui/src/components/header/Header.tsx b/ui/src/components/header/Header.tsx index 5c86b3ae..9c9d60f0 100644 --- a/ui/src/components/header/Header.tsx +++ b/ui/src/components/header/Header.tsx @@ -5,10 +5,12 @@ import logoPath from '../../assets/photoview-logo.svg' import { authToken } from '../../helpers/authentication' const Header = () => ( -
-

- logo - Photoview +
+

+ logo + + Photoview +

{authToken() ? : null}
diff --git a/ui/src/components/header/Searchbar.tsx b/ui/src/components/header/Searchbar.tsx index e043cc4d..813bac4a 100644 --- a/ui/src/components/header/Searchbar.tsx +++ b/ui/src/components/header/Searchbar.tsx @@ -123,7 +123,7 @@ const SearchBar = () => { } return ( -
+
{ - return ( - -
  • - {label} -
    {icon}
    -
  • -
    - ) -} - -export const SideMenu = () => { - const { t } = useTranslation() - - const mapboxQuery = authToken() ? useQuery(MAPBOX_QUERY) : null - - const mapboxEnabled = !!mapboxQuery?.data?.mapboxToken - - return ( -
      - - - - - } - /> - - - - - } - /> - {mapboxEnabled ? ( - - - - - } - /> - ) : null} - - - - - } - /> - - - - - } - /> -
    - ) -} - type LayoutProps = { children: React.ReactNode title: string @@ -204,12 +32,12 @@ const Layout = ({ children, title, ...otherProps }: LayoutProps) => { data-testid="Layout" >
    -
    +
    - +
    {children} diff --git a/ui/src/components/layout/MainMenu.tsx b/ui/src/components/layout/MainMenu.tsx new file mode 100644 index 00000000..2009bc6a --- /dev/null +++ b/ui/src/components/layout/MainMenu.tsx @@ -0,0 +1,159 @@ +import React from 'react' +import { NavLink } from 'react-router-dom' +import { useQuery, gql } from '@apollo/client' +import { authToken } from '../../helpers/authentication' +import { useTranslation } from 'react-i18next' + +export const MAPBOX_QUERY = gql` + query mapboxEnabledQuery { + mapboxToken + } +` + +type MenuButtonProps = { + to: string + exact: boolean + label: string + gradient: string + activeClasses?: string + className?: string + icon?: React.ReactChild +} + +const MenuButton = ({ + to, + exact, + label, + gradient, + icon, + activeClasses, + className, +}: MenuButtonProps) => { + return ( + +
  • +
    + {icon} +
    + {label} +
  • +
    + ) +} + +const MenuSeparator = () => ( +
    +) + +export const MainMenu = () => { + const { t } = useTranslation() + + const mapboxQuery = authToken() ? useQuery(MAPBOX_QUERY) : null + + const mapboxEnabled = !!mapboxQuery?.data?.mapboxToken + + return ( +
    +
      + + + + + } + /> + + + + + } + /> + {mapboxEnabled ? ( + + + + + } + /> + ) : null} + + + + + } + /> + + + + + + } + /> +
    +
    + ) +} + +export default MainMenu diff --git a/ui/src/components/layout/icons/mountain.svg b/ui/src/components/layout/icons/mountain.svg deleted file mode 100644 index 239dbe14..00000000 --- a/ui/src/components/layout/icons/mountain.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file