|
1 | 1 | import type { ComponentChildren } from "preact"; |
2 | 2 | import type { MouseEventHandler } from "preact/compat"; |
3 | | -import type { VotePositionCounts } from "../api"; |
| 3 | +import type { Vote, VotePositionCounts } from "../api"; |
| 4 | +import List from "../components/List"; |
| 5 | +import ListItem from "../components/ListItem"; |
4 | 6 | import { formatDate } from "../lib/dates"; |
| 7 | +import { Island } from "../lib/islands"; |
5 | 8 |
|
6 | 9 | type EmbedType = "members" | "groups" | "countries"; |
7 | 10 |
|
@@ -66,6 +69,71 @@ function DatawrapperLink({ |
66 | 69 | ); |
67 | 70 | } |
68 | 71 |
|
| 72 | +function DataWrapperLinkList({ vote }: { vote: Vote }) { |
| 73 | + return ( |
| 74 | + <List space="xxs"> |
| 75 | + <ListItem |
| 76 | + title={ |
| 77 | + <Island> |
| 78 | + <DatawrapperLink |
| 79 | + type="members" |
| 80 | + voteId={vote.id} |
| 81 | + title={vote.display_title || vote.id.toString()} |
| 82 | + timestamp={vote.timestamp} |
| 83 | + reference={vote.reference} |
| 84 | + description={vote.description} |
| 85 | + stats={vote.stats.total} |
| 86 | + > |
| 87 | + Individual votes |
| 88 | + </DatawrapperLink> |
| 89 | + </Island> |
| 90 | + } |
| 91 | + subtitle={"A searchable table containing each individual MEPs vote."} |
| 92 | + /> |
| 93 | + <ListItem |
| 94 | + title={ |
| 95 | + <Island> |
| 96 | + <DatawrapperLink |
| 97 | + type="groups" |
| 98 | + voteId={vote.id} |
| 99 | + title={vote.display_title || vote.id.toString()} |
| 100 | + timestamp={vote.timestamp} |
| 101 | + reference={vote.reference} |
| 102 | + description={vote.description} |
| 103 | + stats={vote.stats.total} |
| 104 | + > |
| 105 | + Votes by groups |
| 106 | + </DatawrapperLink> |
| 107 | + </Island> |
| 108 | + } |
| 109 | + subtitle={ |
| 110 | + "An interactive barchart showing how members of each group voted." |
| 111 | + } |
| 112 | + /> |
| 113 | + <ListItem |
| 114 | + title={ |
| 115 | + <Island> |
| 116 | + <DatawrapperLink |
| 117 | + type="countries" |
| 118 | + voteId={vote.id} |
| 119 | + title={vote.display_title || vote.id.toString()} |
| 120 | + timestamp={vote.timestamp} |
| 121 | + reference={vote.reference} |
| 122 | + description={vote.description} |
| 123 | + stats={vote.stats.total} |
| 124 | + > |
| 125 | + Votes by countries |
| 126 | + </DatawrapperLink> |
| 127 | + </Island> |
| 128 | + } |
| 129 | + subtitle={ |
| 130 | + "An interactive barchart showing how MEPs from the different member states voted." |
| 131 | + } |
| 132 | + /> |
| 133 | + </List> |
| 134 | + ); |
| 135 | +} |
| 136 | + |
69 | 137 | const GREEN = "rgb(0, 144, 118)"; |
70 | 138 | const RED = "rgb(199, 30, 29)"; |
71 | 139 | const BLUE = "rgb(29, 129, 162)"; |
@@ -288,3 +356,4 @@ function getPresetConfig( |
288 | 356 | } |
289 | 357 |
|
290 | 358 | export default DatawrapperLink; |
| 359 | +export { DataWrapperLinkList }; |
0 commit comments