/
cap-content-router.js
64 lines (54 loc) · 1.45 KB
/
cap-content-router.js
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
import { html, css, LitElement } from "../lib/lit.js";
import "./cap-volume.js";
import "./cap-case.js";
import "./cap-jurisdictions.js";
import "./cap-reporter.js";
import "./cap-disambiguate.js";
export default class CapContentRouter extends LitElement {
static styles = [
css`
cap-case {
display: block;
margin: auto;
padding-top: var(--spacing-250);
padding-bottom: var(--spacing-500);
@media (min-width: 65rem) {
flex: 0 0 58.33333%;
max-width: 58.33333%;
}
}
`,
];
render() {
const searchParams = new URLSearchParams(window.location.search);
const reporter = searchParams.get("reporter");
const volume = searchParams.get("volume");
const casePath = searchParams.get("case");
const disambiguate = searchParams.get("disambiguate");
const cite = searchParams.get("cite");
if (!!disambiguate) {
return html`<cap-disambiguate
list="${disambiguate},"
cite=${cite}
></cap-disambiguate>`;
}
if (!!casePath && !!volume && !!reporter) {
return html`<cap-case
reporter=${reporter}
volume=${volume}
case=${casePath}
></cap-case>`;
}
if (!!volume && !!reporter) {
return html`<cap-volume
reporter=${reporter}
volume=${volume}
></cap-volume>`;
}
if (!!reporter) {
return html`<cap-reporter reporter=${reporter}></cap-reporter>`;
}
return html`<cap-jurisdictions></cap-jurisdictions>`;
}
}
customElements.define("cap-content-router", CapContentRouter);