This repository was archived by the owner on Jan 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchForm.jsx
More file actions
179 lines (174 loc) · 5.27 KB
/
SearchForm.jsx
File metadata and controls
179 lines (174 loc) · 5.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
import React from "react";
import DropdownTrigger from "./DropdownTrigger/DropdownTrigger";
import searchPublicationsIcon from "../../assets/icons/search-publications.svg";
import authorIcon from "../../assets/icons/author.svg";
import institutionIcon from "../../assets/icons/institution.svg";
const SearchForm = ({
searchKeyword,
setSearchKeyword,
author,
setAuthor,
setAuthorObject,
institution,
setInstitution,
setInstitutionObject,
onSearch,
onOpenAdvancedFilters,
onAuthorClick,
onInstitutionClick,
loading,
darkMode = false,
description = "Enter keywords and apply filters to find relevant research"
}) => {
const labelStyle = {
fontWeight: 700,
fontSize: 16,
marginBottom: 4,
display: 'flex',
alignItems: 'center',
gap: 8,
paddingLeft: 2,
color: '#fff'
};
const subLabelStyle = {
fontWeight: 600,
fontSize: 14,
marginBottom: 4,
display: 'flex',
alignItems: 'center',
gap: 6,
color: '#ccc'
};
const inputBoxStyle = {
background: '#222',
border: '1px solid #404040',
borderRadius: 8,
padding: '20px 22px',
fontSize: 18,
width: '100%',
height: 64,
color: '#fff'
};
return (
<div style={{
background: 'rgba(26, 26, 26, 0.25)',
backdropFilter: 'blur(4px)',
borderRadius: 16,
boxShadow: '0 4px 24px rgba(0,0,0,0.3)',
padding: 32,
maxWidth: 900,
margin: '0 auto 2rem auto',
border: '1px solid rgba(64, 64, 64, 0.2)'
}}>
<form onSubmit={e => { e.preventDefault(); onSearch(); }} style={{ display: 'flex', flexDirection: 'column', gap: 20 }}>
<div style={labelStyle}>
<span style={{ display: 'flex', alignItems: 'center' }}>
<img src={searchPublicationsIcon} alt="Search Publications" style={{ marginRight: 4, width: 20, height: 20 }} />
</span>
Search Publications
</div>
<div style={{
color: '#ccc',
fontSize: 14,
marginBottom: 12,
paddingLeft: 2
}}>
{description}
</div>
<input
type="text"
placeholder="Enter keywords..."
value={searchKeyword}
onChange={e => setSearchKeyword(e.target.value)}
style={{
...inputBoxStyle,
marginBottom: 12,
height: 48,
padding: '16px 18px'
}}
/>
<div style={{ display: 'flex', gap: 16 }}>
<div style={{ flex: 1 }}>
<div style={subLabelStyle}>
<span style={{ display: 'flex', alignItems: 'center' }}>
<img src={authorIcon} alt="Author" style={{ marginRight: 3, width: 18, height: 18 }} />
</span>
Author
</div>
<div style={{ width: '100%' }}>
<DropdownTrigger
value={author}
placeholder="Click to search authors..."
onClick={onAuthorClick}
onClear={author ? () => {
setAuthor("");
if (typeof setAuthorObject === 'function') setAuthorObject(null);
} : undefined}
darkMode={darkMode}
/>
</div>
</div>
<div style={{ flex: 1 }}>
<div style={subLabelStyle}>
<span style={{ display: 'flex', alignItems: 'center' }}>
<img src={institutionIcon} alt="Institution" style={{ marginRight: 3, width: 18, height: 18 }} />
</span>
Institution
</div>
<div style={{ width: '100%' }}>
<DropdownTrigger
value={institution}
placeholder="Click to search institutions..."
onClick={onInstitutionClick}
onClear={institution ? () => {
setInstitution("");
if (typeof setInstitutionObject === 'function') setInstitutionObject(null);
} : undefined}
darkMode={darkMode}
/>
</div>
</div>
</div>
<div style={{ display: 'flex', gap: 12, marginTop: 18 }}>
<button
type="submit"
style={{
background: '#4F6AF6',
color: '#fff',
border: 'none',
borderRadius: 8,
padding: '10px 24px',
fontWeight: 600,
cursor: 'pointer',
fontSize: 16,
display: 'flex',
alignItems: 'center',
gap: 8,
opacity: loading ? 0.7 : 1
}}
disabled={loading}
>
{loading ? 'Searching...' : 'Search'}
</button>
<button
type="button"
style={{
background: 'rgba(26, 26, 26, 0.15)',
color: '#4F6AF6',
border: '1px solid #4F6AF6',
borderRadius: 8,
padding: '10px 24px',
fontWeight: 600,
cursor: 'pointer',
fontSize: 16
}}
onClick={onOpenAdvancedFilters}
>
Advanced Filters
</button>
</div>
</form>
</div>
);
};
export default SearchForm;