From 25bfcd987d905d77f2537f759df4f793ec84403f Mon Sep 17 00:00:00 2001 From: Pankamol Srikaew Date: Sat, 23 Mar 2019 20:48:41 +0700 Subject: [PATCH 1/3] add result list to party view --- src/components/PerPartyMemberVoteResult.js | 105 +++++++++++++++++++++ src/components/PerPartyView.js | 23 +---- 2 files changed, 107 insertions(+), 21 deletions(-) create mode 100644 src/components/PerPartyMemberVoteResult.js diff --git a/src/components/PerPartyMemberVoteResult.js b/src/components/PerPartyMemberVoteResult.js new file mode 100644 index 0000000..8db6599 --- /dev/null +++ b/src/components/PerPartyMemberVoteResult.js @@ -0,0 +1,105 @@ +import React from "react" +import { DESKTOP_MIN_WIDTH, media, DISPLAY_FONT } from "../styles" +import _ from "lodash" + +const mockData = [ + { + name: "นายประมูล อึ้งไปเลยสิย้ง", + zone: "ราชบุรี, เขต 3", + vote: "1234567", + percentage: "20", + }, + { + name: "นายย้ง อึ้งไปเลยสิประมูล", + zone: "ราชบุรี, เขต 3", + vote: "672367", + percentage: "20", + }, + { + name: "นายอึ้ง ย้ง", + zone: "ราชบุรี, เขต 3", + vote: "345", + percentage: "20", + }, + { + name: "นายย้ง อึ้ง", + zone: "ราชบุรี, เขต 3", + vote: "22344", + percentage: "20", + }, +] + +// @todo #1 Party View - binding data to ZonePartyMemberVoteResult +export default function ZonePartyMemberVoteResult({ data = mockData }) { + const tabHeaderStyle = { + padding: "15px", + width: "100%", + cursor: "pointer", + border: 0, + borderBottom: "1px solid #000", + ["&:active, &:hover"]: { + background: "#000", + color: "#FFF", + }, + } + return ( +
+

ประมาณจำนวน สส. ที่ได้

+
+ {/* tab */} + { + // @todo #1 Party View - implement interactive tab + } +
+
    +
  • แบ่งเขต(31)
  • +
  • บัญชีรายชื่อ (13)
  • +
+
+ + {/* list */} +
+ {data.map(item => ( +
+ +
+
{item.name}
+
{item.zone}
+
+
+ + {item.vote.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")} + {" "} + - {item.percentage}% +
+
+ ))} +
+
+
+ ) +} diff --git a/src/components/PerPartyView.js b/src/components/PerPartyView.js index e9618ff..18db89f 100644 --- a/src/components/PerPartyView.js +++ b/src/components/PerPartyView.js @@ -6,6 +6,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import ErrorBoundary from "./ErrorBoundary" import ElectionMapContainer from "./ElectionMapContainer" import { Link } from "gatsby" +import PerPartyMemberVoteResult from "./PerPartyMemberVoteResult" export default function PerPartyView() { return ( @@ -26,7 +27,7 @@ export default function PerPartyView() { > - + ) @@ -122,23 +123,3 @@ function ZoneMapView() { ) } - -// @todo #1 show each party vote result -function ZonePartyVoteResult() { - return ( -
- {/* right zone */} -
ประมาณจำนวน สส. ที่ได้
-
- ) -} From 7b99db3a4b4cab0a60dc4606176d9b596184d5de Mon Sep 17 00:00:00 2001 From: Pankamol Srikaew Date: Sat, 23 Mar 2019 20:52:25 +0700 Subject: [PATCH 2/3] add active ja --- src/components/PerPartyMemberVoteResult.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/PerPartyMemberVoteResult.js b/src/components/PerPartyMemberVoteResult.js index 8db6599..6b95fb7 100644 --- a/src/components/PerPartyMemberVoteResult.js +++ b/src/components/PerPartyMemberVoteResult.js @@ -31,15 +31,15 @@ const mockData = [ // @todo #1 Party View - binding data to ZonePartyMemberVoteResult export default function ZonePartyMemberVoteResult({ data = mockData }) { + const active = { background: "#000", color: "#FFF" } const tabHeaderStyle = { padding: "15px", width: "100%", cursor: "pointer", border: 0, borderBottom: "1px solid #000", - ["&:active, &:hover"]: { - background: "#000", - color: "#FFF", + ["&:hover"]: { + active, }, } return ( @@ -71,7 +71,7 @@ export default function ZonePartyMemberVoteResult({ data = mockData }) { width: "100%", }} > -
  • แบ่งเขต(31)
  • +
  • แบ่งเขต(31)
  • บัญชีรายชื่อ (13)
  • From be65d6b55d488c7d05ab46931359a9fcfa2f46ca Mon Sep 17 00:00:00 2001 From: Pankamol Srikaew Date: Sat, 23 Mar 2019 20:58:59 +0700 Subject: [PATCH 3/3] remove unused code