Skip to content

Commit

Permalink
Details pages styling cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystal Ngai committed Mar 3, 2021
1 parent 06230fb commit c46ae30
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 48 deletions.
30 changes: 0 additions & 30 deletions src/__tests__/unit/SearchPagination.test.jsx

This file was deleted.

25 changes: 16 additions & 9 deletions src/components/EditionDetail/Edition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Edition: React.FC<{ editionResult: EditionResult }> = (props) => {
const edition: ApiEdition = props.editionResult.data;

const featuredInstance = edition.instances[0];
console.log("edition", edition);

const toggleShowAll = (e: React.ChangeEvent<HTMLInputElement>) => {
router.push({
Expand Down Expand Up @@ -65,19 +66,25 @@ const Edition: React.FC<{ editionResult: EditionResult }> = (props) => {
</div>

<div className="content-primary">
<DS.Heading level={2} id="featured-edition">
Featured Copy
</DS.Heading>
{featuredInstance && (
<>
<DS.Heading level={2} id="featured-edition">
Featured Copy
</DS.Heading>

<div id="featured-edition-card">
<InstanceCard
editionYear={edition.publication_date}
instance={featuredInstance}
/>
</div>
<div id="featured-edition-card">
<InstanceCard
editionYear={edition.publication_date}
instance={featuredInstance}
/>
</div>
</>
)}

<div id="nypl-item-details">
<hr />
<EditionDetailDefinitionList edition={edition} />
<hr />
{edition.instances && (
<div className="all-instances-header">
<h3
Expand Down
4 changes: 1 addition & 3 deletions src/components/Work/Work.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ const WorkDetail: React.FC<{ workResult: WorkResult }> = (props) => {
});
};

console.log("showAll", router.query.showAll);

return (
<div className="layout-container">
{/* TODO RequestDigital {this.state.requestedEdition && this.getRequestDigital(work)} */}
Expand Down Expand Up @@ -109,7 +107,7 @@ const WorkDetail: React.FC<{ workResult: WorkResult }> = (props) => {
<>Show only items currently available online</>
),
}}
checked={router.query.showAll === "false"}
checked={router.query.showAll !== "true"}
onChange={(e) => toggleShowAll(e)}
/>
</div>
Expand Down
8 changes: 5 additions & 3 deletions src/lib/api/SearchApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const defaultWorkQuery: WorkQuery = {

const defaultEditionQuery = {
editionIdentifier: "",
showAll: "false",
showAll: "true",
};

//TODO: Lower Priority: combine SearchQuery and ApiSearchQuery
Expand Down Expand Up @@ -82,9 +82,11 @@ export const workFetcher = async (query: WorkQuery) => {
export const editionFetcher = async (query: EditionQuery) => {
const editionApiQuery = {
editionIdentifier: query.editionIdentifier,
showAll: query.showAll ? query.showAll : defaultEditionQuery.showAll,
showAll:
typeof query.showAll !== "undefined"
? query.showAll
: defaultEditionQuery.showAll,
};

const res = await fetch(editionUrl, {
method: "POST",
headers: {
Expand Down
1 change: 1 addition & 0 deletions src/pages/edition/[editionId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export async function getServerSideProps(context: any) {
//TODO: Default query
const editionQuery: EditionQuery = {
editionIdentifier: context.query.editionId,
showAll: context.query.showAll,
};

const editionResult: EditionResult = await editionFetcher(editionQuery);
Expand Down
8 changes: 7 additions & 1 deletion styles/components/Search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
.search-filter {
@include space-stack-xs;
border-top: 2px solid var(--section-research-primary);
background-color: var(--ui-gray-light);
background-color: var(--ui-gray-xlight);

h2 {
@include space-inset-xs;
Expand All @@ -28,5 +28,11 @@
}

.filter-button {
@include space-stack-s;

width: 100%
}

.content-bottom {
margin: 0 auto;
}
2 changes: 0 additions & 2 deletions styles/shared/DefinitionList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ dl.nypl-details-table {
}

border-bottom: 1px solid var(--ui-gray-medium);


@media (min-width: #{$breakpoint-medium}) {
flex-flow: row;
flex-wrap: wrap;
Expand Down

0 comments on commit c46ae30

Please sign in to comment.