Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more links to downloads #90

Merged
merged 8 commits into from
Mar 8, 2024
Merged
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
146 changes: 104 additions & 42 deletions src/components/cap-case.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ import {
fetchCaselawBody,
fetchCaseMetadata,
fetchCasesList,
fetchReporterData,
getBreadcrumbLinks,
} from "../lib/data.js";

import { isEmpty } from "../lib/isEmpty.js";
import { fetchOr404 } from "../lib/fetchOr404.js";
import "./cap-breadcrumb.js";

export default class CapCase extends LitElement {
static properties = {
caseBody: { attribute: false },
caseMetadata: { attribute: false },
reporterData: { attribute: false },
reporter: { type: String },
volume: { type: String },
case: { type: String },
Expand All @@ -24,16 +28,57 @@ export default class CapCase extends LitElement {
/* Styles for HTML under our control */
/**/

.case__navigation {
max-width: 80%;
margin-inline: auto;

@media (min-width: 65rem) {
padding-block-end: var(--spacing-200);
}
}

.case__downloadLinks {
margin-block-start: var(--spacing-100);
font-family: var(--font-sans-text);

@media (min-width: 35rem) {
font-size: var(--font-size-175);
}

display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
align-content: space-evenly;
}

.case__downloadLinks a {
color: var(--color-gray-500);
cursor: pointer;
background: none;
border: 2px solid var(--color-gray-500);
font-weight: 600;
font-size: var(--font-size-100);
text-align: center;
text-transform: uppercase;
padding: calc(var(--spacing-125) / 2);
text-decoration: none;
margin: var(--spacing-50);
flex-grow: 1;
}

.case__downloadLinks a:hover {
color: var(--color-blue-400);
border-color: var(--color-blue-400);
}

/* .case-container */

.case-container {
flex: 0 0 83.33333%;
max-width: 83.33333%;
grid-column: 1 / -1;
padding-block-end: var(--spacing-550);
padding-block-start: var(--spacing-400);
margin: auto;

padding-top: 0;
padding-bottom: 100px;

/* styles inherited from "body" in capstone */

letter-spacing: 0.01em;
Expand All @@ -55,7 +100,9 @@ export default class CapCase extends LitElement {
font-size: 0.9em;
font-family: var(--font-serif-titling);
text-align: center;
padding: 2em 2em 0;
padding: 0 2em 0;
max-width: 83.33333%;
margin: auto;
}

@media (min-width: 992px) {
Expand All @@ -76,6 +123,7 @@ export default class CapCase extends LitElement {
line-height: 1.4em;
padding: 0;
margin: 0;
margin-bottom: var(--spacing-50);
}

.case-header .decision-date,
Expand All @@ -90,15 +138,11 @@ export default class CapCase extends LitElement {
/* .metadata */

.metadata {
flex: 0 0 83.33333%;
max-width: 83.33333%;
margin: auto;
}

.metadata .case-name {
flex: 0 0 66.66667%;
max-width: 66.66667%;
margin-left: 16.66667%;
font-family: var(--font-serif);
text-align: center;
}
Expand All @@ -109,14 +153,6 @@ export default class CapCase extends LitElement {
font-style: italic;
}

/* PDF link */

.pdf-link {
font-family: var(--font-sans-text);
text-align: center;
margin: var(--spacing-50) auto -1em;
}

/**/
/* Styles that apply to the injected HTML */
/**/
Expand Down Expand Up @@ -359,6 +395,7 @@ export default class CapCase extends LitElement {
super();
this.caseBody = "";
this.caseMetadata = {};
this.reporterData = {};
}

connectedCallback() {
Expand All @@ -378,6 +415,8 @@ export default class CapCase extends LitElement {
this.case,
(data) => (this.caseMetadata = data),
),
() =>
fetchReporterData(this.reporter, (data) => (this.reporterData = data)),
);
window.addEventListener("hashchange", this.handleHashChange.bind(this));
}
Expand Down Expand Up @@ -455,14 +494,11 @@ export default class CapCase extends LitElement {
getPDFLink() {
if (this.caseMetadata.provenance.source === "Harvard") {
return html`
<div class="pdf-link">
<a
href="${window.BUCKET_ROOT}/${this.reporter}/${this
.volume}.pdf#page=${this.caseMetadata.first_page_order}"
>
View scanned PDF</a
>
</div>
<a
href="${window.BUCKET_ROOT}/${this.reporter}/${this
.volume}.pdf#page=${this.caseMetadata.first_page_order}"
>View scanned PDF</a
>
`;
}
return nothing;
Expand Down Expand Up @@ -536,25 +572,51 @@ export default class CapCase extends LitElement {
window.requestAnimationFrame(this.rewriteLinks);

return html`
<div class="case-container">
<div class="case-header">
<h1>${this.createCaseHeaderHeader(this.caseMetadata)}</h1>
<div>
${this.getDecisionDate(this.caseMetadata.decision_date)}
<span class="court-name">${this.caseMetadata.court?.name}</span>
${this.getDocketNumber(this.caseMetadata.docket_number)}
<div class="case__navigation">
<cap-breadcrumb
.navItems=${getBreadcrumbLinks(
{
slug: this.reporter,
short_name: this.reporterData.short_name,
},
this.volume,
this.caseMetadata.citations[0].cite,
)}
></cap-breadcrumb>
<div class="case__downloadLinks">
${this.getPDFLink()}
<a
href="${window.BUCKET_ROOT}/${this.reporter}/${this
.volume}/cases/${this.case}.json"
>Download case metadata</a
>
<a
href="${window.BUCKET_ROOT}/${this.reporter}/${this
.volume}/html/${this.case}.html"
>Download case HTML</a
>
</div>
</div>
<cap-caselaw-layout>
<div class="case-container">
<div class="case-header">
<h1>${this.createCaseHeaderHeader(this.caseMetadata)}</h1>
<div>
${this.getDecisionDate(this.caseMetadata.decision_date)}
<span class="court-name">${this.caseMetadata.court?.name}</span>
${this.getDocketNumber(this.caseMetadata.docket_number)}
</div>
<div class="citations">
${this.createCitationsString(this.caseMetadata.citations)}
</div>
</div>
<div class="citations">
${this.createCitationsString(this.caseMetadata.citations)}
<div class="metadata">
<div class="case-name">${this.caseMetadata.name}</div>
</div>
<!--section.casebody -->
${unsafeHTML(this.caseBody)}
</div>
<div class="metadata">
<div class="case-name">${this.caseMetadata.name}</div>
</div>
${this.getPDFLink()}
<!--section.casebody -->
${unsafeHTML(this.caseBody)}
</div>
</cap-caselaw-layout>
`;
} else {
return nothing;
Expand Down
11 changes: 7 additions & 4 deletions src/components/cap-content-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ export default class CapContentRouter extends LitElement {
css`
cap-case {
display: block;
flex: 0 0 58.33333%;
max-width: 58.33333%;
margin: auto;
padding-top: 2.5rem;
padding-bottom: 3rem;
padding-top: var(--spacing-250);
padding-bottom: var(--spacing-500);

@media (min-width: 65rem) {
flex: 0 0 58.33333%;
max-width: 58.33333%;
}
}
`,
];
Expand Down
27 changes: 27 additions & 0 deletions src/components/cap-jurisdictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@ export default class CapJurisdictions extends LitElement {
font-family: var(--font-serif);
}

.jurisdictions__button {
margin-top: var(--spacing-75);
}

.jurisdictions__button a {
color: var(--color-gray-600);
cursor: pointer;
background: none;
border: 2px solid var(--color-gray-600);
font-weight: 700;
font-size: var(--font-size-100);
text-transform: uppercase;
width: fit-content;
padding: calc(var(--spacing-125) / 2);
}

.jurisdictions__button a:hover {
color: var(--color-blue-400);
border-color: var(--color-blue-400);
}

.jurisdictions__main {
grid-column: 1 / -1;
padding-inline: var(--spacing-500);
Expand Down Expand Up @@ -160,6 +181,12 @@ export default class CapJurisdictions extends LitElement {
<p class="jurisdictions__description">
Browse all volumes of the Caselaw Access Project below.
</p>
<p class="jurisdictions__description">
Or, <a href="${window.BUCKET_ROOT}">download our data</a>.
</p>
<p class="jurisdictions__button">
<a href="/docs/#bulk-downloads">Learn more about bulk data</a>
</p>
</cap-page-header>
</header>
<aside class="u-w-fit u-sm-hidden">
Expand Down
35 changes: 33 additions & 2 deletions src/components/cap-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ export default class CapReporter extends LitElement {
font-weight: 500;
}

.reporter__downloadLinks {
margin-block-start: var(--spacing-150);
}

.reporter__downloadLinks a {
font-weight: 400;
}

.reporter__volumeList {
margin-block-start: var(--spacing-150);
display: block;
Expand Down Expand Up @@ -116,6 +124,30 @@ export default class CapReporter extends LitElement {
(${this.reporterData.start_year}-${this.reporterData.end_year}).
</p>
</hgroup>
<div class="reporter__downloadLinks">
<p>
Download
<a href="${window.BUCKET_ROOT}/${this.reporter}/">bulk data</a>.
</p>
</div>
<div class="reporter__downloadLinks">
<p>
Download
<a
href="${window.BUCKET_ROOT}/${this
.reporter}/ReporterMetadata.json"
>reporter metadata</a
>.
</p>
<p>
Download
<a
href="${window.BUCKET_ROOT}/${this
.reporter}/VolumesMetadata.json"
>volumes metadata</a
>.
</p>
</div>
<ul class="reporter__volumeList">
<p class="reporter__volumeTitle">Volume number:</p>
${this.volumesData
Expand All @@ -132,8 +164,7 @@ export default class CapReporter extends LitElement {
)}
</ul>
</div>
<cap-caselaw-layout> </cap-caselaw-layout
></cap-caselaw-layout>
</cap-caselaw-layout>
`;
} else {
return nothing;
Expand Down
Loading
Loading