Skip to content

Commit 41e30d2

Browse files
Merge pull request #92 from uday-kalyan-s/fix-input-overflow
Make UI more responsive and CSS cleanup
2 parents 93dd399 + cc97e8d commit 41e30d2

File tree

3 files changed

+45
-62
lines changed

3 files changed

+45
-62
lines changed

frontend/src/components/SearchBar.tsx

+9-11
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,15 @@ const SearchBar: React.FC<SearchBarProps> = ({ onSelectProfessor }) => {
4040
return (
4141
<form className="search-bar-container" onSubmit={onSubmitForm}>
4242
<div className="input-wrapper">
43-
<div>
44-
<FaSearch id="search-icon" />
45-
<input
46-
className="input"
47-
type="text"
48-
placeholder="Who are you looking for?"
49-
value={searchName}
50-
autoFocus={true}
51-
onChange={(e) => handleChange(e.target.value)}
52-
/>
53-
</div>
43+
<FaSearch id="search-icon" />
44+
<input
45+
className="input"
46+
type="text"
47+
placeholder="Who are you looking for?"
48+
value={searchName}
49+
autoFocus={true}
50+
onChange={(e) => handleChange(e.target.value)}
51+
/>
5452
</div>
5553
{dropdownVisibility && (
5654
<div className="dropdown">

frontend/src/components/Table.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ function Table() {
3232
{selectedProfessor && (
3333
<div className="table-container">
3434
<div className="table-caption">
35-
<span>
35+
<span className="space"></span>
3636
<a href={`${selectedProfessor.prof.profile_url}`} target="_blank">
3737
{selectedProfessor.prof.name}
3838
</a>
39-
</span>
4039
<span className="dept space">|</span>
4140
<span className="dept">{selectedProfessor.prof.dept_code}</span>
4241
</div>

frontend/src/index.css

+35-49
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,28 @@
44
}
55

66
.footer-text {
7-
bottom: 0px;
8-
margin: 0 auto;
9-
left: 0;
7+
margin: 0;
108
padding-top: 1rem;
119
padding-bottom: 2px;
12-
width: 100%;
1310
text-align: center;
14-
color: black;
1511
}
1612

1713
.main {
18-
display: flex;
19-
margin: 0 auto;
20-
flex-direction: column;
21-
justify-content: center;
22-
align-items: center;
2314
text-align: center;
2415

2516
.logo {
2617
max-width: 100%;
2718
height: auto;
28-
margin-bottom: -70px;
2919
}
3020

3121
.doodle {
32-
width: 30%;
33-
margin-top: -48px;
22+
width: 90%;
23+
max-width: 500px;
3424
}
3525
}
3626

3727
p {
38-
margin: 0 auto !important;
39-
text-align: center !important;
40-
width: 70% !important;
28+
margin: 5vh;
4129
}
4230

4331
* {
@@ -47,39 +35,32 @@ p {
4735
h1 {
4836
font-size: 60px;
4937
font-weight: 200;
38+
margin: 0;
5039
}
5140

5241
.input-wrapper {
53-
position: relative;
54-
color: black;
55-
width: 100%;
56-
height: 2.5rem;
42+
display: flex;
43+
flex-direction: row;
44+
justify-items: center;
45+
align-items: center;
5746
border: none;
5847
border-radius: 10px;
59-
padding: 0 15px;
48+
padding: 7px;
6049
box-shadow: 0px 0px 8px #ddd;
6150
background-color: white;
62-
display: flex;
63-
margin-bottom: 20px;
6451
}
6552

6653
.search-bar-container {
67-
display: flex;
68-
flex-direction: column;
69-
position: relative;
70-
margin: 0 auto;
71-
width: 45%;
72-
margin-top: 20px;
73-
justify-content: center;
74-
align-items: center;
54+
width: 100%;
55+
width: fit-content;
56+
max-width: 90%;
57+
padding: 10px;
58+
min-width: 40%;
7559
}
7660

7761
.input-wrapper input {
78-
color: black;
7962
background-color: transparent;
80-
height: 100%;
8163
font-size: 1.25rem;
82-
width: 500px;
8364
border: none;
8465
margin-left: 10px;
8566
padding-left: 15px;
@@ -90,24 +71,17 @@ input:focus {
9071
}
9172

9273
#search-icon {
93-
position: absolute;
94-
top: 50%;
95-
left: 13px;
96-
transform: translateY(-50%);
9774
color: royalblue;
98-
margin-right: 10px;
9975
}
10076

10177
.dropdown {
10278
width: 100%;
103-
background-color: white;
104-
max-height: 250px;
79+
margin-top: 10px;
10580
}
10681

10782
.dropdown-row {
10883
padding: 10px;
10984
cursor: pointer;
110-
color: black;
11185
outline: none;
11286
}
11387

@@ -127,10 +101,8 @@ a:hover {
127101
.search-results {
128102
display: flex;
129103
flex-direction: column;
130-
flex-wrap: wrap;
131-
width: 100%;
132-
height: 100%;
133104
align-items: center;
105+
justify-content: center;
134106

135107
.time-table {
136108
display: flex;
@@ -147,22 +119,36 @@ a:hover {
147119
display: none;
148120
}
149121

150-
.table-caption {
122+
.table-container {
151123
display: flex;
152-
justify-content: center;
153-
font-weight: "lighter";
124+
flex-direction: column;
125+
align-items: center;
126+
}
154127

128+
.table-caption {
129+
display: flex;
155130
.dept {
156131
font-size: 2rem;
132+
display: inline;
133+
157134
}
158135

159136
.space {
160137
margin: 0 8px;
138+
display: inline;
161139
}
162140

163141
a {
164142
font-size: 2rem;
165143
}
144+
@media screen and (max-width: 700px) {
145+
a {
146+
max-width: 300px;
147+
overflow-x: hidden;
148+
white-space: nowrap;
149+
text-overflow: ellipsis;
150+
}
151+
}
166152
}
167153

168154
.table {
@@ -174,7 +160,7 @@ a:hover {
174160
overflow-x: auto;
175161
/*table-layout: fixed;*/
176162

177-
163+
/* margin: 0 auto; */
178164
td {
179165
padding: 8px 2px;
180166
border: 1px solid #ddd;

0 commit comments

Comments
 (0)