Skip to content

Commit 8d6e8b2

Browse files
committed
style: improve layout by displaying form and results side-by-side with better styling
1 parent ff78764 commit 8d6e8b2

File tree

1 file changed

+89
-50
lines changed

1 file changed

+89
-50
lines changed

src/pages/SearchPage.tsx

Lines changed: 89 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -25,65 +25,104 @@ const SearchPage: React.FC = () => {
2525
};
2626

2727
return (
28-
<Container maxWidth="md" style={{ marginTop: "2rem" }}>
28+
<Container
29+
// maxWidth="md"
30+
style={{
31+
marginTop: "2rem",
32+
// backgroundColor: "rgba(97, 109, 243, 0.4)",
33+
// backdropFilter: "blur(10px)",
34+
backgroundColor: Colors.white,
35+
padding: "2rem",
36+
borderRadius: 4,
37+
width: "100%",
38+
}}
39+
>
2940
<Box
3041
sx={{
31-
backgroundColor: "white",
32-
p: 3,
33-
borderRadius: 2,
34-
boxShadow: 1,
42+
// backgroundColor: "white",
43+
// p: 3,
44+
// borderRadius: 2,
45+
// boxShadow: 1,
46+
display: "flex",
47+
gap: 3,
48+
alignItems: "flex-start",
3549
}}
3650
>
37-
<Form
38-
schema={schema}
39-
onSubmit={handleSubmit}
40-
validator={validator}
41-
liveValidate
42-
/>
51+
<Box
52+
sx={{
53+
// flex: "0 0 300px", // fixed width
54+
flex: 1,
55+
backgroundColor: "white",
56+
p: 3,
57+
borderRadius: 2,
58+
boxShadow: 1,
59+
}}
60+
>
61+
<Form
62+
schema={schema}
63+
onSubmit={handleSubmit}
64+
validator={validator}
65+
liveValidate
66+
/>
67+
</Box>
4368

44-
{hasSearched && searchResults && (
45-
<Box mt={4}>
46-
{Array.isArray(searchResults) ? (
47-
searchResults.length > 0 ? (
48-
<>
69+
<Box
70+
sx={{
71+
flex: 2,
72+
backgroundColor: "white",
73+
paddingLeft: 3,
74+
paddingRight: 3,
75+
borderRadius: 2,
76+
boxShadow: 1,
77+
}}
78+
>
79+
{hasSearched && searchResults && (
80+
<Box mt={4}>
81+
{Array.isArray(searchResults) ? (
82+
searchResults.length > 0 ? (
83+
<>
84+
<Typography
85+
variant="h6"
86+
sx={{ borderBottom: "1px solid lightgray" }}
87+
>
88+
{`Found ${searchResults.length} Datasets`}
89+
</Typography>
90+
<ul>
91+
{searchResults.map((item, idx) => {
92+
const label = `${item.dbname}/${item.dsname}`;
93+
const link = `${RoutesEnum.DATABASES}/${item.dbname}/${item.dsname}`;
94+
95+
return (
96+
<Box key={idx} mb={1}>
97+
<Link
98+
to={link}
99+
style={{
100+
textDecoration: "none",
101+
color: Colors.blue,
102+
}}
103+
>
104+
{label}
105+
</Link>
106+
</Box>
107+
);
108+
})}
109+
</ul>
110+
</>
111+
) : (
49112
<Typography variant="h6">
50-
{`Found ${searchResults.length} Datasets`}
113+
No matching dataset was found
51114
</Typography>
52-
<ul>
53-
{searchResults.map((item, idx) => {
54-
const label = `${item.dbname}/${item.dsname}`;
55-
const link = `${RoutesEnum.DATABASES}/${item.dbname}/${item.dsname}`;
56-
57-
return (
58-
<Box key={idx} mb={1}>
59-
<Link
60-
to={link}
61-
style={{
62-
textDecoration: "none",
63-
color: Colors.blue,
64-
}}
65-
>
66-
{label}
67-
</Link>
68-
</Box>
69-
);
70-
})}
71-
</ul>
72-
</>
115+
)
73116
) : (
74-
<Typography variant="h6">
75-
No matching dataset was found
117+
<Typography color="error">
118+
{searchResults?.msg === "empty output"
119+
? "No results found based on your criteria. Please adjust the filters and try again."
120+
: "Something went wrong. Please try again later."}
76121
</Typography>
77-
)
78-
) : (
79-
<Typography color="error">
80-
{searchResults?.msg === "empty output"
81-
? "No results found based on your criteria. Please adjust the filters and try again."
82-
: "Something went wrong. Please try again later."}
83-
</Typography>
84-
)}
85-
</Box>
86-
)}
122+
)}
123+
</Box>
124+
)}
125+
</Box>
87126
</Box>
88127
</Container>
89128
);

0 commit comments

Comments
 (0)