diff --git a/src/Components/Common/components/AccordionV2.tsx b/src/Components/Common/components/AccordionV2.tsx new file mode 100644 index 00000000000..e2b4ca54d93 --- /dev/null +++ b/src/Components/Common/components/AccordionV2.tsx @@ -0,0 +1,73 @@ +import React, { useState } from "react"; + +export default function AccordionV2(props: { + children: JSX.Element | JSX.Element[]; + expandIcon?: JSX.Element; + title: JSX.Element | JSX.Element[] | string; + className?: string; + expanded?: boolean; +}) { + const [toggle, setToggle] = useState(props.expanded as boolean); + const contentEl = React.useRef(null); + + return ( +
+
+ + +
+
+ {props.children} +
+
+ ); +} diff --git a/src/Components/Common/components/CollapseV2.tsx b/src/Components/Common/components/CollapseV2.tsx new file mode 100644 index 00000000000..6552868b6ac --- /dev/null +++ b/src/Components/Common/components/CollapseV2.tsx @@ -0,0 +1,54 @@ +import React, { useEffect, useState } from "react"; + +export default function CollapseV2(props: { + children: JSX.Element | JSX.Element[]; + opened: boolean; + className?: string; +}) { + const content = React.useRef(null); + const [innerDivState, setInnerDivState] = useState(false); + const [outerDivState, setOuterDivState] = useState(false); + + useEffect(() => { + if (props.opened) { + setOuterDivState(props.opened); + setTimeout(() => { + setInnerDivState(props.opened); + }, 1); + } else { + setInnerDivState(props.opened); + setTimeout(() => { + setOuterDivState(props.opened); + }, 300); + } + }, [props.opened]); + + return ( +
+
+ {props.children} +
+
+ ); +} diff --git a/src/Components/Common/components/ResponsiveMedicineTables.tsx b/src/Components/Common/components/ResponsiveMedicineTables.tsx index 7500b9f4efa..271563a4d2f 100644 --- a/src/Components/Common/components/ResponsiveMedicineTables.tsx +++ b/src/Components/Common/components/ResponsiveMedicineTables.tsx @@ -1,9 +1,5 @@ -import { - Accordion, - AccordionDetails, - AccordionSummary, -} from "@material-ui/core"; import { useEffect, useState } from "react"; +import AccordionV2 from "./AccordionV2"; function getWindowSize() { const { innerWidth, innerHeight } = window; @@ -67,31 +63,11 @@ export default function ResponsiveMedicineTable(props: { ) : (
{props.list.map((med: any, index: number) => ( - - - - - } - aria-controls={`panel${index + 1}a-content`} - id={`panel${index + 1}a-header`} - > +
-

+

{med[props.objectKeys[0]]}

@@ -106,35 +82,40 @@ export default function ResponsiveMedicineTable(props: { ))}
- - -
-
- {props.objectKeys.map((key, i) => { - if (i !== 0 && i !== props.objectKeys.length - 1) - return ( -
-

- {props.theads[i]} -

{" "} -

{med[key]}

-
- ); + } + className={ + props.list.length - 1 === index + ? "bg-white p-5 " + : "bg-white p-5 border-b border-b-gray-400" + } + key={index} + > +
+
+ {props.objectKeys.map((key, i) => { + if (i !== 0 && i !== props.objectKeys.length - 1) + return ( +
+

+ {props.theads[i]} +

{" "} +

{med[key]}

+
+ ); - if (i === props.objectKeys.length - 1) - return ( -
-

- {props.theads[i]} -

{" "} -

{med[key]}

-
- ); - })} -
+ if (i === props.objectKeys.length - 1) + return ( +
+

+ {props.theads[i]} +

{" "} +

{med[key]}

+
+ ); + })}
- - +
+ ))}
)} diff --git a/src/Components/Common/components/SelectMenu.tsx b/src/Components/Common/components/SelectMenu.tsx index 3a2f1fa3fea..8869916cf99 100644 --- a/src/Components/Common/components/SelectMenu.tsx +++ b/src/Components/Common/components/SelectMenu.tsx @@ -12,6 +12,7 @@ type Props = { selected?: T; label?: string; position?: string; + parentRelative?: boolean; }; export default function SelectMenu(props: Props) { @@ -34,7 +35,13 @@ export default function SelectMenu(props: Props) { {({ open }) => ( <> {props.label} -
+
diff --git a/src/Components/Facility/HospitalList.tsx b/src/Components/Facility/HospitalList.tsx index bea9146376c..97463b51d8f 100644 --- a/src/Components/Facility/HospitalList.tsx +++ b/src/Components/Facility/HospitalList.tsx @@ -22,6 +22,7 @@ import { sendNotificationMessages, } from "../../Redux/actions"; import loadable from "@loadable/component"; + import { InputLabel, TextField } from "@material-ui/core"; import Pagination from "../Common/Pagination"; import { FacilityModel } from "./models"; @@ -29,11 +30,7 @@ import { InputSearchBox } from "../Common/SearchBox"; import { CSVLink } from "react-csv"; import moment from "moment"; import { Theme, createStyles, makeStyles } from "@material-ui/core/styles"; -import Accordion from "@material-ui/core/Accordion"; import CircularProgress from "@material-ui/core/CircularProgress"; -import AccordionSummary from "@material-ui/core/AccordionSummary"; -import AccordionDetails from "@material-ui/core/AccordionDetails"; -import Typography from "@material-ui/core/Typography"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; import GetAppIcon from "@material-ui/icons/GetApp"; import { make as SlideOver } from "../Common/SlideOver.gen"; @@ -42,6 +39,7 @@ import { useTranslation } from "react-i18next"; import * as Notification from "../../Utils/Notifications.js"; import { Modal } from "@material-ui/core"; import SelectMenu from "../Common/components/SelectMenu"; +import AccordionV2 from "../Common/components/AccordionV2"; const Loading = loadable(() => import("../Common/Loading")); const PageTitle = loadable(() => import("../Common/PageTitle")); @@ -558,80 +556,74 @@ export const HospitalList = (props: any) => {
- - } - aria-controls="panel1a-content" - id="panel1a-header" - > - - {t("downloads")} - - - -
- - {t("download_type")} - -
- ({ - title: download, - value: download, - })), - ]} - selected={downloadSelect} - onSelect={setdownloadSelect} - position="right" - /> - {downloadLoading ? ( -
- -
- ) : ( - - )} -
-
-
- - - - + Downloads

} + className="lg:mt-0 md:mt-0 sm:mt-0 bg-white shadow-md rounded-lg p-3 relative" + expandIcon={} + > +
+ + {t("download_type")} + +
+ ({ + title: download, + value: download, + })), + ]} + selected={downloadSelect} + onSelect={setdownloadSelect} + position="left" + parentRelative={false} + /> + {downloadLoading ? ( +
+ +
+ ) : ( + + )}
- - +
+
+ + + + +
+
@@ -704,6 +696,7 @@ export const HospitalList = (props: any) => {
+
diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index b15dbabeff5..fc47eef9fc5 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -1,12 +1,8 @@ import { - Accordion, - AccordionDetails, - AccordionSummary, Box, Card, CardContent, CircularProgress, - Collapse, FormControlLabel, InputLabel, Radio, @@ -63,7 +59,10 @@ import { goBack } from "../../Utils/utils"; const Loading = loadable(() => import("../Common/Loading")); const PageTitle = loadable(() => import("../Common/PageTitle")); +import AccordionV2 from "../Common/components/AccordionV2"; +import CollapseV2 from "../Common/components/CollapseV2"; import { debounce } from "lodash"; +// const debounce = require("lodash.debounce"); interface PatientRegisterProps extends PatientModel { facilityId: number; @@ -1140,11 +1139,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { />
- + {
{
} -
+
{ - - } - aria-controls="panel1a-content" - id="panel1a-header" - > -

+ } + title={ +

Health Details

- - -
+ } + > +
+
{ /> -
@@ -1532,7 +1524,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { disableFuture={true} />
-
+
@@ -1564,10 +1556,8 @@ export const PatientRegister = (props: PatientRegisterProps) => {
- {
@@ -1604,7 +1594,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { onChange={handleChange} style={{ padding: "0px 5px" }} > - +
} @@ -1620,7 +1610,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { control={} label="3 (Booster/Precautionary Dose)" /> - +
@@ -1670,7 +1660,7 @@ export const PatientRegister = (props: PatientRegisterProps) => {
} - +
Contact with confirmed Covid patient? @@ -1724,8 +1714,8 @@ export const PatientRegister = (props: PatientRegisterProps) => {
- { state.form.contact_with_suspected_carrier ) } - timeout="auto" - unmountOnExit >
@@ -1783,7 +1771,7 @@ export const PatientRegister = (props: PatientRegisterProps) => { />
-
+
{ />
- - +
+