Skip to content

Commit

Permalink
Improve weight and height fields in consultation form (#5180)
Browse files Browse the repository at this point in the history
* fixes #5170

* fix responsiveness
  • Loading branch information
rithviknishad authored Mar 29, 2023
1 parent 9679022 commit 4ceec21
Showing 1 changed file with 38 additions and 23 deletions.
61 changes: 38 additions & 23 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -918,30 +918,45 @@ export const ConsultationForm = (props: any) => {
</div>

<div className="col-span-6">
<div className="flex flex-col w-full md:flex-row gap-x-3">
<div className="w-1/2" ref={fieldRef["weight"]}>
<TextFormField
{...field("weight")}
label="Weight (kg)"
placeholder="kg"
/>
</div>
<div className="w-1/2" ref={fieldRef["height"]}>
<TextFormField
{...field("height")}
label="Height (cm)"
placeholder="cm"
/>
</div>
<div className="flex items-center justify-between">
<FieldLabel>Body Surface Area</FieldLabel>
<span className="mb-2 text-black font-medium text-sm">
{Math.sqrt(
(Number(state.form.weight) *
Number(state.form.height)) /
3600
).toFixed(2)}
m<sup>2</sup>
</span>
</div>
<div id="body_surface" className="flex-1">
Body Surface area :{" "}
{Math.sqrt(
(Number(state.form.weight) *
Number(state.form.height)) /
3600
).toFixed(2)}{" "}
m<sup>2</sup>

<div className="flex flex-col sm:flex-row items-center sm:gap-3">
<TextFormField
className="w-full"
{...field("weight")}
type="number"
placeholder="Weight"
trailingPadding=" "
trailing={
<p className="text-sm text-gray-700 mr-8">
Weight (kg)
</p>
}
min={0}
/>
<TextFormField
className="w-full"
{...field("height")}
type="number"
placeholder="Height"
trailingPadding=" "
trailing={
<p className="text-sm text-gray-700 mr-8">
Height (cm)
</p>
}
min={0}
/>
</div>
</div>

Expand Down

0 comments on commit 4ceec21

Please sign in to comment.