In progress header components.

This commit is contained in:
Patrick Fic
2019-12-03 19:03:34 -07:00
parent 8bcb4516c5
commit 0741915b66
12 changed files with 1927 additions and 884 deletions

0
client/.env Normal file
View File

View File

@@ -2,12 +2,17 @@
"name": "bodyshop", "name": "bodyshop",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"license": "Copyright Snapt Software (C) 2019",
"dependencies": { "dependencies": {
"@material-ui/core": "^4.7.1", "@material-ui/core": "^4.7.1",
"@material-ui/icons": "^4.5.1",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"node-sass": "^4.13.0",
"react": "^16.12.0", "react": "^16.12.0",
"react-dom": "^16.12.0", "react-dom": "^16.12.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0", "react-scripts": "3.2.0",
"styled-components": "^4.4.1",
"typeface-roboto": "^0.0.75" "typeface-roboto": "^0.0.75"
}, },
"scripts": { "scripts": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 766 B

View File

@@ -28,7 +28,7 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>React App</title> <title>BodyShop | ImEX Systems Inc.</title>
</head> </head>
<body> <body>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>

View File

@@ -1,28 +1,16 @@
import React from 'react'; import React from "react";
import logo from './logo.svg'; import "./App.css";
import './App.css';
import 'typeface-roboto'; import "typeface-roboto";
function App() { import HeaderAppBar from "./components/header-app-bar/header-app-bar.component";
return (~
<div className="App"> const App = () => {
<header className="App-header"> return (
<img src={logo} className="App-logo" alt="logo" /> <div>
<p> <HeaderAppBar />
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div> </div>
); );
} };
export default App; export default App;

View File

@@ -0,0 +1,175 @@
import React from "react";
//Local Imports
import { default as SearchBox } from "../search-box/search-box.component";
//Styles
import AppBarStyles from "./header-app-bar.styles";
//Material UI Imports
import AppBar from "@material-ui/core/AppBar";
import Toolbar from "@material-ui/core/Toolbar";
import IconButton from "@material-ui/core/IconButton";
//import Typography from "@material-ui/core/Typography";
import Badge from "@material-ui/core/Badge";
import MenuItem from "@material-ui/core/MenuItem";
import Menu from "@material-ui/core/Menu";
import MenuIcon from "@material-ui/icons/Menu";
import AccountCircle from "@material-ui/icons/AccountCircle";
import MailIcon from "@material-ui/icons/Mail";
import NotificationsIcon from "@material-ui/icons/Notifications";
import MoreIcon from "@material-ui/icons/MoreVert";
import SearchIcon from "@material-ui/icons/Search";
import InputBase from "@material-ui/core/InputBase";
export default function PrimarySearchAppBar() {
const classes = AppBarStyles();
const [anchorEl, setAnchorEl] = React.useState(null);
const [mobileMoreAnchorEl, setMobileMoreAnchorEl] = React.useState(null);
const isMenuOpen = Boolean(anchorEl);
const isMobileMenuOpen = Boolean(mobileMoreAnchorEl);
const handleProfileMenuOpen = event => {
setAnchorEl(event.currentTarget);
};
const handleMobileMenuClose = () => {
setMobileMoreAnchorEl(null);
};
const handleMenuClose = () => {
setAnchorEl(null);
handleMobileMenuClose();
};
const handleMobileMenuOpen = event => {
setMobileMoreAnchorEl(event.currentTarget);
};
const menuId = 'primary-search-account-menu';
const renderMenu = (
<Menu
anchorEl={anchorEl}
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
id={menuId}
keepMounted
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
open={isMenuOpen}
onClose={handleMenuClose}
>
<MenuItem onClick={handleMenuClose}>Profile</MenuItem>
<MenuItem onClick={handleMenuClose}>My account</MenuItem>
</Menu>
);
const mobileMenuId = 'primary-search-account-menu-mobile';
const renderMobileMenu = (
<Menu
anchorEl={mobileMoreAnchorEl}
anchorOrigin={{ vertical: 'top', horizontal: 'right' }}
id={mobileMenuId}
keepMounted
transformOrigin={{ vertical: 'top', horizontal: 'right' }}
open={isMobileMenuOpen}
onClose={handleMobileMenuClose}
>
<MenuItem>
<IconButton aria-label="show 4 new mails" color="inherit">
<Badge badgeContent={4} color="secondary">
<MailIcon />
</Badge>
</IconButton>
<p>Messages</p>
</MenuItem>
<MenuItem>
<IconButton aria-label="show 11 new notifications" color="inherit">
<Badge badgeContent={11} color="secondary">
<NotificationsIcon />
</Badge>
</IconButton>
<p>Notifications</p>
</MenuItem>
<MenuItem onClick={handleProfileMenuOpen}>
<IconButton
aria-label="account of current user"
aria-controls="primary-search-account-menu"
aria-haspopup="true"
color="inherit"
>
<AccountCircle />
</IconButton>
<p>Profile</p>
</MenuItem>
</Menu>
);
return (
<div className={classes.grow}>
<AppBar position="static">
<Toolbar>
<IconButton
edge="start"
className={classes.menuButton}
color="inherit"
aria-label="open drawer"
>
<MenuIcon />
</IconButton>
<SearchBox />
<div className={classes.search}>
<div className={classes.searchIcon}>
<SearchIcon />
</div>
<InputBase
placeholder="Search…"
classes={{
root: classes.inputRoot,
input: classes.inputInput,
}}
inputProps={{ 'aria-label': 'search' }}
/>
</div>
<div className={classes.grow} />
<div className={classes.sectionDesktop}>
<IconButton aria-label="show 4 new mails" color="inherit">
<Badge badgeContent={4} color="secondary">
<MailIcon />
</Badge>
</IconButton>
<IconButton aria-label="show 17 new notifications" color="inherit">
<Badge badgeContent={17} color="secondary">
<NotificationsIcon />
</Badge>
</IconButton>
<IconButton
edge="end"
aria-label="account of current user"
aria-controls={menuId}
aria-haspopup="true"
onClick={handleProfileMenuOpen}
color="inherit"
>
<AccountCircle />
</IconButton>
</div>
<div className={classes.sectionMobile}>
<IconButton
aria-label="show more"
aria-controls={mobileMenuId}
aria-haspopup="true"
onClick={handleMobileMenuOpen}
color="inherit"
>
<MoreIcon />
</IconButton>
</div>
</Toolbar>
</AppBar>
{renderMobileMenu}
{renderMenu}
</div>
);
}

View File

@@ -0,0 +1,62 @@
import { fade, makeStyles } from "@material-ui/core/styles";
export default makeStyles(theme => ({
grow: {
flexGrow: 1
},
menuButton: {
marginRight: theme.spacing(2)
},
title: {
display: "none",
[theme.breakpoints.up("sm")]: {
display: "block"
}
},
search: {
position: "relative",
borderRadius: theme.shape.borderRadius,
backgroundColor: fade(theme.palette.common.white, 0.15),
"&:hover": {
backgroundColor: fade(theme.palette.common.white, 0.25)
},
marginRight: theme.spacing(2),
marginLeft: 0,
width: "100%",
[theme.breakpoints.up("sm")]: {
marginLeft: theme.spacing(3),
width: "auto"
}
},
searchIcon: {
width: theme.spacing(7),
height: "100%",
position: "absolute",
pointerEvents: "none",
display: "flex",
alignItems: "center",
justifyContent: "center"
},
inputRoot: {
color: "inherit"
},
inputInput: {
padding: theme.spacing(1, 1, 1, 7),
transition: theme.transitions.create("width"),
width: "100%",
[theme.breakpoints.up("md")]: {
width: 200
}
},
sectionDesktop: {
display: "none",
[theme.breakpoints.up("md")]: {
display: "flex"
}
},
sectionMobile: {
display: "flex",
[theme.breakpoints.up("md")]: {
display: "none"
}
}
}));

View File

@@ -0,0 +1,25 @@
import React from "react";
import SearchBoxStyles from "./search-box.styles";
//Material UI Imports
import SearchIcon from "@material-ui/icons/Search";
import InputBase from "@material-ui/core/InputBase";
export default function SearchBox() {
const classes = SearchBoxStyles();
return (
<div className={classes.search}>
<div className={classes.searchIcon}>
<SearchIcon />
</div>
<InputBase
placeholder="Search…"
classes={{
root: classes.inputRoot,
input: classes.inputInput
}}
inputProps={{ "aria-label": "search" }}
/>
</div>
);
}

View File

@@ -0,0 +1,38 @@
import { fade, makeStyles } from "@material-ui/core/styles";
export default makeStyles(theme => ({
search: {
position: "relative",
borderRadius: theme.shape.borderRadius,
backgroundColor: fade(theme.palette.common.white, 0.15),
"&:hover": {
backgroundColor: fade(theme.palette.common.white, 0.25)
},
marginRight: theme.spacing(2),
marginLeft: 0,
width: "100%",
[theme.breakpoints.up("sm")]: {
marginLeft: theme.spacing(3),
width: "auto"
}
},
searchIcon: {
width: theme.spacing(7),
height: "100%",
position: "absolute",
pointerEvents: "none",
display: "flex",
alignItems: "center",
justifyContent: "center"
},
inputRoot: {
color: "inherit"
},
inputInput: {
padding: theme.spacing(1, 1, 1, 7),
transition: theme.transitions.create("width"),
width: "100%",
[theme.breakpoints.up("md")]: {
width: 200
}
}
}));

View File

@@ -1,10 +1,18 @@
import React from 'react'; import React from "react";
import ReactDOM from 'react-dom'; import ReactDOM from "react-dom";
import './index.css'; import { BrowserRouter } from "react-router-dom";
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root')); import * as serviceWorker from "./serviceWorker";
import "./index.css";
import App from "./App";
ReactDOM.render(
<BrowserRouter>
<App />
</BrowserRouter>,
document.getElementById("root")
);
// If you want your app to work offline and load faster, you can change // If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls. // unregister() to register() below. Note this comes with some pitfalls.

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
{ {
"name": "bodyshop-server", "name": "bodyshop-server",
"version": "0.0.1", "version": "0.0.1",
"license": "Copyright Snapt Software (C) 2019",
"engines": { "engines": {
"node": "12.13.1", "node": "12.13.1",
"npm": "6.11.3" "npm": "6.11.3"