Skip to content

Commit

Permalink
Responsive animation working
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Campbell committed Aug 11, 2020
1 parent 8d30372 commit 82a18f2
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 12 deletions.
15 changes: 10 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,22 @@ function App(){
transition: transitionWidth
},
"rightCol": {
width: "0",
overflow: "hidden",
width: "0",
height: "100vh",
transition: transitionWidth
},
"rightColShift": {
width: "50vw",
flexShrink: "0",
overflow: "auto",
width: "100vw",
flexShrink: "0",
transition: transitionWidth
}
},
[theme.breakpoints.up("md")]: {
"rightColShift": {
width: "40vw",
}
},
});

const classes = useStyles();
Expand All @@ -54,7 +59,7 @@ function App(){
<ItemTable activeItem={activeItem} setActiveItem={setActiveItem}/>
</Box>
<Box className={clsx(classes.rightCol, sidebarOpen && classes.rightColShift)}>
<ItemView activeItem={activeItem}/>
<ItemView activeItem={activeItem} setActiveItem={setActiveItem}/>
</Box>
</Box>
</ThemeProvider>
Expand Down
13 changes: 6 additions & 7 deletions src/ItemView.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import React, { useState, useEffect } from 'react';
import React from 'react';
import { ListItem, ListItemIcon, ListItemText, Paper, Typography, Divider } from '@material-ui/core';
import FolderIcon from '@material-ui/icons/Folder';
import PersonIcon from '@material-ui/icons/Person';
import CalendarIcon from '@material-ui/icons/CalendarToday';
import AssignmentdIcon from '@material-ui/icons/AssignmentInd';
import InfoIcon from '@material-ui/icons/Info';
import ClockIcon from '@material-ui/icons/QueryBuilder';
import ItemViewAppBar from './ItemViewAppBar'

function ItemView(props){
return(
<Paper>
<ListItem>
<Typography variant="h4">
{props.activeItem["queue"] + " " + props.activeItem["number"]}
</Typography>
</ListItem>
<ItemViewAppBar
title={props.activeItem["queue"] + " " + props.activeItem["number"]}
setActiveItem={props.setActiveItem}
/>

<ListItem>
<Typography variant="h5">
Expand Down
39 changes: 39 additions & 0 deletions src/ItemViewAppBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from "react";
import {makeStyles, Tooltip, Typography, AppBar, Toolbar, IconButton, Zoom} from "@material-ui/core"
import CloseItemViewIcon from '@material-ui/icons/ChevronRight';


export default function ItemViewAppBar(props){
const useStyles = makeStyles((theme) => ({
closeButton: {
marginRight: theme.spacing(2),
},
title: {
flexGrow: "1"
},
}));

const classes = useStyles(props.theme);

return(
<>
<AppBar position="sticky" color="secondary" elevation={0}>
<Toolbar>
<Tooltip title={"Close Item"}
arrow
onClick={() => props.setActiveItem({})}
TransitionComponent={Zoom}
>
<IconButton color="inherit" className={classes.closeButton}>
<CloseItemViewIcon />
</IconButton>
</Tooltip>

<Typography variant="h6" className={classes.title}>
{props.title}
</Typography>
</Toolbar>
</AppBar>
</>
);
}

0 comments on commit 82a18f2

Please sign in to comment.