- Notifications
You must be signed in to change notification settings - Fork928
feat: add top-level nav styles#883
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import List from "@material-ui/core/List" | ||
import ListItem from "@material-ui/core/ListItem" | ||
import { fade, makeStyles } from "@material-ui/core/styles" | ||
import React from "react" | ||
import {NavLink } from "react-router-dom" | ||
import { UserResponse } from "../../api/types" | ||
import { Logo } from "../Icons" | ||
import { UserDropdown } from "./UserDropdown" | ||
@@ -14,29 +15,34 @@ export interface NavbarViewProps { | ||
export const NavbarView: React.FC<NavbarViewProps> = ({ user, onSignOut }) => { | ||
const styles = useStyles() | ||
return ( | ||
<nav className={styles.root}> | ||
<List className={styles.fixed}> | ||
<ListItem className={styles.item}> | ||
<NavLink className={styles.logo} to="/"> | ||
<Logo fill="white" opacity={1} width={125} /> | ||
</NavLink> | ||
</ListItem> | ||
<ListItem button className={styles.item}> | ||
<NavLink className={styles.link} to="/templates"> | ||
Templates | ||
</NavLink> | ||
</ListItem> | ||
</List> | ||
<div className={styles.fullWidth} /> | ||
<div className={styles.fixed}>{user && <UserDropdown user={user} onSignOut={onSignOut} />}</div> | ||
</nav> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. praise: for fixing the semantics of this HTML There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. yay! | ||
) | ||
} | ||
const useStyles = makeStyles((theme) => ({ | ||
root: { | ||
position: "relative", | ||
display: "flex", | ||
flex:0, | ||
flexDirection: "row", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
height:56, | ||
background: theme.palette.navbar.main, | ||
marginTop: 0, | ||
transition: "margin 150ms ease", | ||
@@ -46,24 +52,60 @@ const useStyles = makeStyles((theme) => ({ | ||
borderBottom: `1px solid #383838`, | ||
}, | ||
fixed: { | ||
flex: 0, | ||
display: "flex", | ||
padding: 0, | ||
}, | ||
fullWidth: { | ||
flex:1, | ||
}, | ||
logo: { | ||
alignItems: "center", | ||
display: "flex", | ||
height: 56, | ||
paddingLeft: theme.spacing(4), | ||
paddingRight: theme.spacing(2), | ||
"& svg": { | ||
width: 125, | ||
}, | ||
}, | ||
title: { | ||
flex:1, | ||
textAlign: "center", | ||
}, | ||
item: { | ||
padding: 0, | ||
}, | ||
link: { | ||
alignItems: "center", | ||
color: "#A7A7A7", | ||
display: "flex", | ||
fontSize: 16, | ||
height: 56, | ||
padding: `0 ${theme.spacing(3)}px`, | ||
textDecoration: "none", | ||
transition: "background-color 0.3s ease", | ||
"&:hover": { | ||
backgroundColor: fade(theme.palette.primary.light, 0.1), | ||
}, | ||
// NavLink adds this class when the current route matches. | ||
"&.active": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. chef's kiss | ||
position: "relative", | ||
color: theme.palette.primary.contrastText, | ||
"&::before": { | ||
content: `"{"`, | ||
left: 10, | ||
position: "absolute", | ||
}, | ||
"&::after": { | ||
content: `"}"`, | ||
position: "absolute", | ||
right: 10, | ||
}, | ||
}, | ||
}, | ||
})) |