Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,49 +54,51 @@ const SearchBar = ({ value, onChange, onSearch }) => {
data-searching={searching}
data-testid="search-bar"
>
<form
data-testid="search-bar-form"
className="uds-form p-0 col-md-6 col-sm-12"
onSubmit={e => {
e.preventDefault();
onSearch();
setSearching(true);
timeoutId = setTimeout(() => setSearching(false), 500);
clearTimeout(timeoutId);
}}
>
<div className="form-group mb-0 me-2">
<label htmlFor="search-field">Search</label>
<search>
<form
data-testid="search-bar-form"
className="uds-form p-0 col-md-6 col-sm-12"
onSubmit={e => {
e.preventDefault();
onSearch();
setSearching(true);
timeoutId = setTimeout(() => setSearching(false), 500);
clearTimeout(timeoutId);
}}
>
<div className="form-group mb-0 me-2">
<label htmlFor="search-field">Search</label>

<div className="d-flex row align-items-baseline g-3">
<div className="col-sm-12 col-md-6 align-self-end">
<input
data-testid="search-field"
id="search-field"
value={value}
type="text"
className="form-control"
placeholder="Search degree programs"
onChange={e => {
onChange(e.target.value);
trackSearchEvent(e.target.value);
}}
/>
</div>
<div className="d-flex row align-items-baseline g-3">
<div className="col-sm-12 col-md-6 align-self-end">
<input
data-testid="search-field"
id="search-field"
value={value}
type="text"
className="form-control"
placeholder="Search degree programs"
onChange={e => {
onChange(e.target.value);
trackSearchEvent(e.target.value);
}}
/>
</div>

<div className="col-sm-12 col-md-6 mt-2 mt-sm-0">
<Button
data-testid="search-button"
color="maroon"
label="Search now"
ariaLabel="Search now"
size="default"
onClick={onSearch}
/>
<div className="col-sm-12 col-md-6 mt-2 mt-sm-0">
<Button
data-testid="search-button"
color="maroon"
label="Search now"
ariaLabel="Search now"
size="default"
onClick={onSearch}
/>
</div>
</div>
</div>
</div>
</form>
</form>
</search>
</Section>
);
};
Expand Down
42 changes: 22 additions & 20 deletions packages/app-webdir-ui/src/SearchPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,26 +131,28 @@ function SearchPage({
<span className="highlight-gold">Search</span>
</h1>
<div className="options-area">
<form className="uds-form">
<div className="form-group">
<input
type="text"
className="form-control"
id="search-input"
placeholder="Search asu.edu"
value={searchValue}
onChange={e => setSearchValue(e.target.value)}
onKeyDown={inputKeyPress}
ref={inputRef}
/>
<Button
color="maroon"
icon={["fas", "search"]}
label="Search"
onClick={() => doSearch()}
/>
</div>
</form>
<search>
<form className="uds-form">
<div className="form-group">
<input
type="text"
className="form-control"
id="search-input"
placeholder="Search asu.edu"
value={searchValue}
onChange={e => setSearchValue(e.target.value)}
onKeyDown={inputKeyPress}
ref={inputRef}
/>
<Button
color="maroon"
icon={["fas", "search"]}
label="Search"
onClick={() => doSearch()}
/>
</div>
</form>
</search>
<div className="profile-options">
<div className="desktop-button">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,70 +79,72 @@ const Search = () => {
});
};
return (
<SearchWrapper
// @ts-ignore
breakpoint={breakpoint}
action={searchUrl}
onSubmit={handleSearch}
method="get"
name="gs"
className={open ? CLASS_NAMES.OPEN_SEARCH : ""}
data-testid="universal-nav-search-form"
role="search"
>
{!isMobile ? (
<>
{!open && (
<button
type="button"
aria-label="Search asu.edu"
onClick={handleChangeVisibility}
className={CLASS_NAMES.SEARCH_BUTTON}
data-testid="search-button"
>
<span>Search</span>
<FontAwesomeIcon icon={faSearch} />
</button>
)}
{open && (
<>
<SearchInput
inputRef={inputRef}
hasInputValue={hasInputValue}
setHasInputValue={setHasInputValue}
isMobile={isMobile}
onBlur={() => {
if (!hasInputValue) setOpen(false);
}}
/>
<Button
color="dark"
text="Search"
as="button"
classes={CLASS_NAMES.SUBMIT_BUTTON}
/>
</>
)}
</>
) : (
<label>
<SearchInput
inputRef={inputRef}
hasInputValue={hasInputValue}
setHasInputValue={setHasInputValue}
isMobile={isMobile}
/>
</label>
)}
<input name="url_host" value={site} type="hidden" />
<input name="site" value="default_collection" type="hidden" />
<input name="sort" value="date:D:L:d1" type="hidden" />
<input name="output" value="xml_no_dtd" type="hidden" />
<input name="ie" value="UTF-8" type="hidden" />
<input name="oe" value="UTF-8" type="hidden" />
<input name="client" value="asu_frontend" type="hidden" />
<input name="proxystylesheet" value="asu_frontend" type="hidden" />
</SearchWrapper>
<search>
<SearchWrapper
// @ts-ignore
breakpoint={breakpoint}
action={searchUrl}
onSubmit={handleSearch}
method="get"
name="gs"
className={open ? CLASS_NAMES.OPEN_SEARCH : ""}
data-testid="universal-nav-search-form"
role="search"
>
{!isMobile ? (
<>
{!open && (
<button
type="button"
aria-label="Search asu.edu"
onClick={handleChangeVisibility}
className={CLASS_NAMES.SEARCH_BUTTON}
data-testid="search-button"
>
<span>Search</span>
<FontAwesomeIcon icon={faSearch} />
</button>
)}
{open && (
<>
<SearchInput
inputRef={inputRef}
hasInputValue={hasInputValue}
setHasInputValue={setHasInputValue}
isMobile={isMobile}
onBlur={() => {
if (!hasInputValue) setOpen(false);
}}
/>
<Button
color="dark"
text="Search"
as="button"
classes={CLASS_NAMES.SUBMIT_BUTTON}
/>
</>
)}
</>
) : (
<label>
<SearchInput
inputRef={inputRef}
hasInputValue={hasInputValue}
setHasInputValue={setHasInputValue}
isMobile={isMobile}
/>
</label>
)}
<input name="url_host" value={site} type="hidden" />
<input name="site" value="default_collection" type="hidden" />
<input name="sort" value="date:D:L:d1" type="hidden" />
<input name="output" value="xml_no_dtd" type="hidden" />
<input name="ie" value="UTF-8" type="hidden" />
<input name="oe" value="UTF-8" type="hidden" />
<input name="client" value="asu_frontend" type="hidden" />
<input name="proxystylesheet" value="asu_frontend" type="hidden" />
</SearchWrapper>
</search>
);
};

Expand Down