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

Make investigation table responsive / scrollable #5812

Merged
merged 6 commits into from
Jul 1, 2023
Merged
Changes from all commits
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
12 changes: 8 additions & 4 deletions src/Components/Facility/Investigations/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const TestRow = ({ data, value, onChange, i }: any) => {
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
{data.name}
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-700 text-right">
<td className="px-6 py-4 min-w-[200px] whitespace-nowrap text-sm text-gray-700 text-right">
{data.investigation_type === "Choice" ? (
<SelectFormField
name={data.name}
Expand All @@ -19,6 +19,7 @@ const TestRow = ({ data, value, onChange, i }: any) => {
optionLabel={(o: string) => o}
optionValue={(o: string) => o}
onChange={onChange}
errorClassName="hidden"
/>
) : (
<TextFormField
Expand Down Expand Up @@ -63,7 +64,7 @@ export const TestTable = ({ title, data, state, dispatch }: any) => {
};

return (
<div className="p-4 m-4">
<div className="md:p-4 md:m-4">
{title && <h1 className="text-3xl font-bold">{title}</h1>}
<br />
<TextFormField
Expand All @@ -75,7 +76,7 @@ export const TestTable = ({ title, data, state, dispatch }: any) => {
onChange={(e) => setSearchFilter(e.value)}
/>
<br />
<div className="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
<div className="shadow border-b border-gray-200 sm:rounded-lg overflow-x-scroll sm:overflow-x-visible">
<table className="min-w-full divide-y divide-gray-200">
<thead className="bg-gray-50">
<tr>
Expand All @@ -99,7 +100,10 @@ export const TestTable = ({ title, data, state, dispatch }: any) => {
data={t}
i={i}
key={t.external_id}
value={state[t.external_id] && state[t.external_id].value}
value={
state[t.external_id] &&
(state[t.external_id].value ?? state[t.external_id].notes)
}
onChange={(e: FieldChangeEvent<string>) =>
handleValueChange(
t.investigation_type === "Float"
Expand Down
Loading