-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtab.js
37 lines (35 loc) · 1.05 KB
/
tab.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
import { html } from "./html.js";
import { Container } from "./container.js";
import cc from "./web_modules/classcat.js";
import { preventDefault } from "./web_modules/@hyperapp/events.js";
import { addCustomStatsToReport } from "./stats.js";
import { update } from "./update.js";
const ChangeReportType = reportType => state => {
const report = addCustomStatsToReport({
report: state.report,
reportType,
days: state.days
});
return update({
...state,
reportType,
report,
sortOrder: ["lastCases", "desc"]
});
};
export const tab = ({ reportType }) => html`
<${Container}>
<ul class="tab tab-block">
<li class=${cc({ "tab-item": true, active: reportType === "confirmed" })}>
<a href="#" onclick=${preventDefault(
ChangeReportType("confirmed")
)}>Confirmed</a>
</li>
<li class=${cc({ "tab-item": true, active: reportType === "deaths" })}>
<a href="#" onclick=${preventDefault(
ChangeReportType("deaths")
)}>Deaths</a>
</li>
</ul>
</${Container}>
`;