Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1764 update styling #1811

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 24 additions & 31 deletions client/src/components/Admin/ParentOrganizations.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import { useParentOrganizations } from "hooks/useParentOrganizations";
import makeStyles from "@mui/styles/makeStyles";
import Paper from "@mui/material/Paper";
import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody";
Expand Down Expand Up @@ -43,32 +42,9 @@ function getModalStyle() {
};
}

const useStyles = makeStyles((theme) => ({
container: {
maxHeight: "500px",
cursor: "pointer",
},
heading: {
marginBottom: theme.spacing(1),
display: "flex",
justifyContent: "space-between",
},
paper: {
position: "absolute",
width: 400,
backgroundColor: theme.palette.background.paper,
boxShadow: theme.shadows[5],
padding: theme.spacing(2, 4, 3),
},
error: {
color: theme.palette.error.main,
},
}));

function ParentOrganizations(props) {
let { data, status } = useParentOrganizations();
const [parentOrgs, setParentOrgs] = React.useState([]);
const classes = useStyles();
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(10);
const [activeOrg, setActiveOrg] = React.useState(false);
Expand Down Expand Up @@ -139,19 +115,26 @@ function ParentOrganizations(props) {

return (
<Container maxWidth="sm">
<div className={classes.heading}>
<Box sx={ (theme) => ({
display: "flex",
justifyContent: "space-between",
marginBottom: theme.spacing(1),
})}>
<h2 style={{ margin: 0 }}>Parent Organizations</h2>
<Button variant="outlined" onClick={handleAddNew}>
Add New
</Button>
</div>
</Box>

{deleteError && (
<div className={classes.error}>Something went wrong.</div>
<Box sx={(theme) => ({color: theme.palette.error.main})}>
Something went wrong.
</Box>
)}

<Paper>
<TableContainer className={classes.container}>
<TableContainer
sx={{ maxHeight: "500px", cursor: "pointer" }}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
Expand Down Expand Up @@ -243,7 +226,15 @@ function ParentOrganizations(props) {
aria-labelledby="parent-org-modal"
aria-describedby="parent-org-modal-description"
>
<div style={modalStyle} className={classes.paper}>
<Box style={modalStyle}
sx={(theme) => ({
position: "absolute",
width: 400,
backgroundColor: theme.palette.background.paper,
boxShadow: theme.shadows[5],
padding: theme.spacing(2, 4, 3),
})}
>
<div id="simple-modal-title">
<h2>Edit Parent Organization</h2>
</div>
Expand Down Expand Up @@ -295,7 +286,9 @@ function ParentOrganizations(props) {
/>
</div>
{error && (
<div className={classes.error}>Something went wrong.</div>
<Box sx={(theme) => ({color: theme.palette.error.main})}>
Something went wrong.
</Box>
)}
<Box mt={3} display="flex" justifyContent="space-between">
<Button
Expand All @@ -315,7 +308,7 @@ function ParentOrganizations(props) {
</form>
)}
</Formik>
</div>
</Box>
</Modal>
</Paper>
</Container>
Expand Down