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

Added support for multi-line text input for Doctor Notes #6977

Merged
merged 18 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 2 additions & 3 deletions src/Components/Facility/ConsultationDoctorNotes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useState } from "react";
import * as Notification from "../../../Utils/Notifications.js";
import Page from "../../Common/components/Page";
import TextFormField from "../../Form/FormFields/TextFormField";
import ButtonV2 from "../../Common/components/ButtonV2";
import CareIcon from "../../../CAREUI/icons/CareIcon";
import { NonReadOnlyUsers } from "../../../Utils/AuthorizeFor";
Expand All @@ -13,6 +12,7 @@ import request from "../../../Utils/request/request.js";
import useQuery from "../../../Utils/request/useQuery.js";
import useKeyboardShortcut from "use-keyboard-shortcut";
import { isAppleDevice } from "../../../Utils/utils.js";
import TextAreaFormField from "../../Form/FormFields/TextAreaFormField.js";

interface ConsultationDoctorNotesProps {
patientId: string;
Expand Down Expand Up @@ -120,12 +120,11 @@ const ConsultationDoctorNotes = (props: ConsultationDoctorNotesProps) => {
/>

<div className="relative mx-4 flex items-center">
<TextFormField
<TextAreaFormField
name="note"
value={noteField}
onChange={(e) => setNoteField(e.value)}
className="grow"
type="text"
errorClassName="hidden"
placeholder="Type your Note"
disabled={!patientActive}
Expand Down
5 changes: 2 additions & 3 deletions src/Components/Facility/PatientNotesSlideover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as Notification from "../../Utils/Notifications.js";
import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor";
import CareIcon from "../../CAREUI/icons/CareIcon";
import { classNames, isAppleDevice } from "../../Utils/utils";
import TextFormField from "../Form/FormFields/TextFormField";
import ButtonV2 from "../Common/components/ButtonV2";
import { make as Link } from "../Common/components/Link.bs";
import { useMessageListener } from "../../Common/hooks/useMessageListener";
Expand All @@ -12,6 +11,7 @@ import request from "../../Utils/request/request";
import routes from "../../Redux/api";
import { PatientNoteStateType } from "./models";
import useKeyboardShortcut from "use-keyboard-shortcut";
import TextAreaFormField from "../Form/FormFields/TextAreaFormField.js";

interface PatientNotesProps {
patientId: string;
Expand Down Expand Up @@ -169,13 +169,12 @@ export default function PatientNotesSlideover(props: PatientNotesProps) {
setReload={setReload}
/>
<div className="relative mx-4 flex items-center">
<TextFormField
<TextAreaFormField
id="doctor_notes_textarea"
name="note"
value={noteField}
onChange={(e) => setNoteField(e.value)}
className="grow"
type="text"
errorClassName="hidden"
placeholder="Type your Note"
disabled={!patientActive}
Expand Down
4 changes: 4 additions & 0 deletions src/Components/Form/FormFields/TextAreaFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ type TextAreaFormFieldProps = FormFieldBaseProps<string> & {
rows?: number;
// prefixIcon?: React.ReactNode;
// suffixIcon?: React.ReactNode;
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement>) => void;
};

const TextAreaFormField = ({ rows = 3, ...props }: TextAreaFormFieldProps) => {
Expand All @@ -25,6 +27,8 @@ const TextAreaFormField = ({ rows = 3, ...props }: TextAreaFormFieldProps) => {
className={`cui-input-base resize-none ${
field.error && "border-danger-500"
}`}
onFocus={props.onFocus}
onBlur={props.onBlur}
/>
</FormField>
);
Expand Down
Loading