-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
re-struction patient list component - create new directory and move s… (
#194) * re-struction patient list component - create new directory and move subcomponents * lint fixes * lint fix * remove un-needed comment * add defaults * Update PatientListTable.js - lint fix * code clean up * lint fix * bug fix * lint fix * bug fix, refactor * move style code * code clean up, lint fix * lint fix * remove commented out code --------- Co-authored-by: Amy Chen <clone@cesium.cirg.washington.edu>
- Loading branch information
Showing
25 changed files
with
1,288 additions
and
1,054 deletions.
There are no files selected for viewing
9 changes: 7 additions & 2 deletions
9
.../__tests__/components/DetailPanel.test.js → ...omponents/patientList/DetailPanel.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import { shallow } from "enzyme"; | ||
import React from "react"; | ||
import DetailPanel from "../../js/components/DetailPanel"; | ||
import DetailPanel from "../../../js/components/patientList/DetailPanel"; | ||
|
||
describe("DetailPanel", () => { | ||
it("DetailPanel component renders without crashing", () => { | ||
const wrapper = shallow(<DetailPanel />); | ||
const data = { | ||
rowData: { | ||
id: 1, | ||
}, | ||
}; | ||
const wrapper = shallow(<DetailPanel data={data} />); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
}); |
2 changes: 1 addition & 1 deletion
2
...rc/__tests__/components/FilterRow.test.js → .../components/patientList/FilterRow.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...sts__/components/PatientListTable.test.js → ...ents/patientList/PatientListTable.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
patientsearch/src/js/components/patientList/DetailPanel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import Button from "@material-ui/core/Button"; | ||
import Paper from "@material-ui/core/Paper"; | ||
import { makeStyles } from "@material-ui/core/styles"; | ||
import { usePatientListContext } from "../../context/PatientListContextProvider"; | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
detailPanelWrapper: { | ||
backgroundColor: "#dde7e6", | ||
padding: theme.spacing(0.25), | ||
}, | ||
detailPanelContainer: { | ||
position: "relative", | ||
minHeight: theme.spacing(8), | ||
backgroundColor: "#fbfbfb", | ||
}, | ||
detailPanelCloseButton: { | ||
position: "absolute", | ||
top: theme.spacing(1.5), | ||
right: theme.spacing(6), | ||
color: theme.palette.primary.main, | ||
}, | ||
})); | ||
|
||
export default function DetailPanel({ data }) { | ||
const classes = useStyles(); | ||
let { | ||
getDetailPanelContent = function () {}, | ||
onDetailPanelClose = function () {}, | ||
} = usePatientListContext(); | ||
|
||
return ( | ||
<div className={classes.detailPanelWrapper}> | ||
<Paper | ||
elevation={1} | ||
variant="outlined" | ||
className={classes.detailPanelContainer} | ||
> | ||
{getDetailPanelContent(data)} | ||
<Button | ||
onClick={() => { | ||
onDetailPanelClose(data); | ||
}} | ||
className={classes.detailPanelCloseButton} | ||
size="small" | ||
> | ||
Close X | ||
</Button> | ||
</Paper> | ||
</div> | ||
); | ||
} | ||
|
||
DetailPanel.propTypes = { | ||
data: PropTypes.object.isRequired, | ||
}; |
21 changes: 21 additions & 0 deletions
21
patientsearch/src/js/components/patientList/DropdownMenu.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Dropdown from "../Dropdown"; | ||
import { usePatientListContext } from "../../context/PatientListContextProvider"; | ||
|
||
export default function DropdownMenu() { | ||
let { | ||
anchorEl, | ||
getMenuItems = function () { | ||
return null; | ||
}, | ||
handleMenuClose = function () {}, | ||
handleMenuSelect = function () {}, | ||
} = usePatientListContext(); | ||
return ( | ||
<Dropdown | ||
anchorEl={anchorEl} | ||
handleMenuClose={handleMenuClose} | ||
handleMenuSelect={handleMenuSelect} | ||
menuItems={getMenuItems()} | ||
></Dropdown> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.