Skip to content

Commit

Permalink
made doctor notes input size dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijv256 committed Jan 10, 2024
1 parent afafb0c commit 7e264f6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Components/Facility/ConsultationDoctorNotes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ const ConsultationDoctorNotes = (props: ConsultationDoctorNotesProps) => {
const [patientName, setPatientName] = useState("");
const [focused, setFocused] = useState(false);

const textArea = document.getElementById("doctor_consultation_notes");
textArea?.addEventListener("keydown", autosize);
function autosize() {
setTimeout(function () {
if (textArea == null) return;
textArea.style.cssText =
"min-height:36px; height: 36px; overflow-y: hidden; height:" +
textArea.scrollHeight +
"px";
}, 0);
}

const initialData: PatientNoteStateType = {
notes: [],
cPage: 1,
Expand Down Expand Up @@ -121,6 +133,8 @@ const ConsultationDoctorNotes = (props: ConsultationDoctorNotesProps) => {

<div className="relative mx-4 flex items-center">
<TextAreaFormField
id="doctor_consultation_notes"
rows={1}
name="note"
value={noteField}
onChange={(e) => setNoteField(e.value)}
Expand Down
13 changes: 13 additions & 0 deletions src/Components/Facility/PatientNotesSlideover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ export default function PatientNotesSlideover(props: PatientNotesProps) {
const [reload, setReload] = useState(false);
const [focused, setFocused] = useState(false);

const textArea = document.getElementById("doctor_notes_textarea");
textArea?.addEventListener("keydown", autosize);
function autosize() {
setTimeout(function () {
if (textArea == null) return;
textArea.style.cssText =
"min-height:36px; height: 36px; overflow-y: hidden; height:" +
textArea.scrollHeight +
"px";
}, 0);
}

const initialData: PatientNoteStateType = {
notes: [],
cPage: 1,
Expand Down Expand Up @@ -171,6 +183,7 @@ export default function PatientNotesSlideover(props: PatientNotesProps) {
<div className="relative mx-4 flex items-center">
<TextAreaFormField
id="doctor_notes_textarea"
rows={1}
name="note"
value={noteField}
onChange={(e) => setNoteField(e.value)}
Expand Down

0 comments on commit 7e264f6

Please sign in to comment.