Skip to content

Commit

Permalink
Advanced Search styling and test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystal Ngai committed Mar 4, 2021
1 parent c46ae30 commit 003f1e0
Show file tree
Hide file tree
Showing 12 changed files with 296 additions and 358 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
moduleNameMapper: {
"^~(.*)$": "<rootDir>$1",
},
testPathIgnorePatterns: ["<rootDir>/.next/", "<rootDir>/node_modules/"],
testPathIgnorePatterns: ["<rootDir>/.next/", "<rootDir>/node_modules/", "testUtils"],
setupFilesAfterEnv: ["./setupTests.js"],
snapshotSerializers: ["enzyme-to-json/serializer"],
resetMocks: true,
Expand Down
40 changes: 0 additions & 40 deletions src/__tests__/helpers/browser

This file was deleted.

37 changes: 0 additions & 37 deletions src/__tests__/helpers/routing

This file was deleted.

100 changes: 48 additions & 52 deletions src/components/AdvancedSearch/AdvancedSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,18 @@ const AdvancedSearch: React.FC<{
};

return (
<main id="mainContent" className="main">
<div className="content-header">
<main id="mainContent" className="main advanced-search">
<div className="content-top">
<DS.Breadcrumbs
modifiers={["space-under"]}
breadcrumbs={[{ url: "/", text: breadcrumbTitles.home }]}
/>
</div>

<div aria-label="Digital Research Books Beta" className="grid-col-12">
<div className="sfr-header-wrapper grid-col-10">
<h1 className="nypl-heading">Digital Research Books Beta</h1>

<div id="tagline">
Search the world&apos;s research collections and more for digital
books you can use right now
</div>
</div>
<div className="content-primary">
<DS.Heading level={1}>Advanced Search</DS.Heading>

<form
className="usa-form grid-container width-full margin-x-0 padding-x-0"
onSubmit={(e) => {
submit(e);
}}
Expand All @@ -162,31 +155,31 @@ const AdvancedSearch: React.FC<{
</DS.HelperErrorText>
)}
<fieldset>
<legend>Advanced Search</legend>

{inputTerms.map((field: { key: string; label: string }) => {
return (
<div key={`field-${field.key}`}>
<DS.Label
htmlFor={`${field.key}-input`}
id={`${field.key}-label`}
>
{field.label}
</DS.Label>
<DS.Input
id={`${field.key}-input`}
ariaLabel={`Input for ${field.label}`}
value={
findQueryForField(searchQuery.queries, field.key)
? findQueryForField(searchQuery.queries, field.key)
.query
: ""
}
onChange={(e) => onQueryChange(e, field.key)}
/>
</div>
);
})}
<div className="search-fields">
{inputTerms.map((field: { key: string; label: string }) => {
return (
<div key={`field-${field.key}`}>
<DS.Label
htmlFor={`${field.key}-input`}
id={`${field.key}-label`}
>
{field.label}
</DS.Label>
<DS.Input
id={`${field.key}-input`}
ariaLabel={`Input for ${field.label}`}
value={
findQueryForField(searchQuery.queries, field.key)
? findQueryForField(searchQuery.queries, field.key)
.query
: ""
}
onChange={(e) => onQueryChange(e, field.key)}
/>
</div>
);
})}
</div>
</fieldset>
{languages.length > 0 && (
<LanguageAccordion
Expand All @@ -211,21 +204,24 @@ const AdvancedSearch: React.FC<{
onBookFormatChange(e, format);
}}
/>
<DS.Button
id="search-button"
buttonType={DS.ButtonTypes.Primary}
type="submit"
>
Search
</DS.Button>
<DS.Button
id="clear-button"
buttonType={DS.ButtonTypes.Secondary}
type="reset"
onClick={() => clearSearch()}
>
Clear
</DS.Button>
<hr />
<div className="button-container">
<DS.Button
id="search-button"
buttonType={DS.ButtonTypes.Primary}
type="submit"
>
Search
</DS.Button>
<DS.Button
id="clear-button"
buttonType={DS.ButtonTypes.Secondary}
type="reset"
onClick={() => clearSearch()}
>
Clear
</DS.Button>
</div>
</form>
</div>
</main>
Expand Down
Loading

0 comments on commit 003f1e0

Please sign in to comment.