From 73cc79dfff8ae6704ac991fc6f518c4d77fa6f3a Mon Sep 17 00:00:00 2001 From: Scarlett Perry <39421794+scarlettperry@users.noreply.github.com> Date: Thu, 3 Dec 2020 14:27:40 -0500 Subject: [PATCH] ui v2: header (#696) --- .../packages/core/src/AppLayout/header.tsx | 61 ++++---- frontend/packages/core/src/AppLayout/logo.tsx | 19 +-- .../core/src/AppLayout/notifications.tsx | 86 ++++++++++++ .../src/AppLayout/stories/header.stories.tsx | 27 ++++ .../stories/notifications.stories.tsx | 17 +++ .../stories/user-information.stories.tsx | 23 +++ frontend/packages/core/src/AppLayout/user.tsx | 131 +++++++++++++----- 7 files changed, 287 insertions(+), 77 deletions(-) create mode 100644 frontend/packages/core/src/AppLayout/notifications.tsx create mode 100644 frontend/packages/core/src/AppLayout/stories/header.stories.tsx create mode 100644 frontend/packages/core/src/AppLayout/stories/notifications.stories.tsx create mode 100644 frontend/packages/core/src/AppLayout/stories/user-information.stories.tsx diff --git a/frontend/packages/core/src/AppLayout/header.tsx b/frontend/packages/core/src/AppLayout/header.tsx index a9da4a4f87..95c15f553e 100644 --- a/frontend/packages/core/src/AppLayout/header.tsx +++ b/frontend/packages/core/src/AppLayout/header.tsx @@ -1,46 +1,33 @@ import React from "react"; import { Link } from "react-router-dom"; -import { - AppBar as MuiAppBar, - Box, - Divider as MuiDivider, - IconButton, - Toolbar, - Typography, -} from "@material-ui/core"; +import styled from "@emotion/styled"; +import { AppBar as MuiAppBar, Box, Grid, IconButton, Toolbar, Typography } from "@material-ui/core"; import MenuIcon from "@material-ui/icons/Menu"; -import styled from "styled-components"; import Drawer from "./drawer"; import Logo from "./logo"; +import Notifications from "./notifications"; import SearchField from "./search"; import { UserInformation } from "./user"; -const AppBar = styled(MuiAppBar)` - ${({ theme }) => ` - min-width: fit-content; - background-color: ${theme.palette.secondary.main}; - color: ${theme.palette.primary.main}; - min-width: fit-content; - `} -`; +// TODO (sperry): make header responsive for small devices +const AppBar = styled(MuiAppBar)({ + minWidth: "fit-content", + background: "linear-gradient(90deg, #38106b 4.58%, #131c5f 89.31%)", +}); -const MenuButton = styled(IconButton)` - padding: 12px; - margin-left: -12px; -`; +const MenuButton = styled(IconButton)({ + padding: "12px", + marginLeft: "-12px", +}); -const Title = styled(Typography)` - margin-right: 25px; - font-weight: bolder; -`; - -const Divider = styled(MuiDivider)` - ${({ theme }) => ` - background-color: ${theme.palette.primary.main}; - margin: 16px 8px; - `} -`; +// TODO (sperry): remove marginRight in new search bar design +const Title = styled(Typography)({ + margin: "12px 25px 12px 8px", + fontWeight: "bold", + fontSize: "20px", + color: "rgba(255, 255, 255, 0.87)", +}); const Header: React.FC = () => { const [drawerOpen, setDrawerOpen] = React.useState(false); @@ -68,7 +55,7 @@ const Header: React.FC = () => { return ( <> - + @@ -76,12 +63,14 @@ const Header: React.FC = () => { - - clutch + clutch - + + + + diff --git a/frontend/packages/core/src/AppLayout/logo.tsx b/frontend/packages/core/src/AppLayout/logo.tsx index 8fe6a34b3b..1587498402 100644 --- a/frontend/packages/core/src/AppLayout/logo.tsx +++ b/frontend/packages/core/src/AppLayout/logo.tsx @@ -1,5 +1,6 @@ import React from "react"; -import styled, { keyframes } from "styled-components"; +import { keyframes } from "@emotion/react"; +import styled from "@emotion/styled"; const rotate = keyframes` from { @@ -10,13 +11,15 @@ const rotate = keyframes` } `; -const StyledSvg = styled.svg` - height: 40px; - width: 40px; - &:hover { - animation: ${rotate} 5s linear; - } -`; +const StyledSvg = styled.svg({ + height: "48px", + width: "48px", + padding: "8px", + "&:hover": { + animation: `${rotate} 5s linear`, + }, + verticalAlign: "middle", +}); const Logo: React.FC = () => (