Skip to content

Commit 4de52d2

Browse files
Change to Grid of Buttons, Order buttons by selected
1 parent 5f5472c commit 4de52d2

File tree

4 files changed

+43
-50
lines changed

4 files changed

+43
-50
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24+
.idea/

src/App.css

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
flex-direction: column;
77
align-items: center;
88
justify-content: center;
9-
font-family: 'Raleway';
9+
font-family: 'Raleway', sans-serif;
1010
}
1111

1212

@@ -50,19 +50,8 @@
5050
}
5151
}
5252

53-
.checkbox {
54-
background-color: #eeeeee;
55-
margin: -5px;
56-
padding: 10px;
57-
border-radius: 5px;
58-
}
59-
60-
.checkbox:checked {
61-
background-color: #88e5ff;
62-
}
63-
64-
.checkbox:hover {
65-
background-color: #d2f5ff;
53+
.county-col {
54+
order: -1;
6655
}
6756

6857
tspan {

src/Graph.js

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ import {
1111
ResponsiveContainer
1212
} from "recharts";
1313
import {
14-
Checkbox,
15-
Table,
1614
Grid,
1715
Container,
1816
Loader,
1917
Input,
20-
Message
18+
Message,
19+
Button
2120
} from "semantic-ui-react";
2221
import queryString from "query-string";
2322
import { numberWithCommas } from "./utils";
@@ -198,44 +197,29 @@ export default class Graph extends PureComponent {
198197
</Grid.Row>
199198

200199
<Grid.Row>
201-
<Table basic="very" celled collapsing unstackable>
202200
{this.state.error && (
203201
<Message color="blue">{this.state.error}</Message>
204202
)}
205-
<Table.Header>
206-
<Table.Row>
207-
<Table.Cell>County</Table.Cell>
208-
<Table.Cell>Cases</Table.Cell>
209-
<Table.Cell>Weekly growth</Table.Cell>
210-
</Table.Row>
211-
</Table.Header>
212-
<Table.Body>
203+
204+
<Grid padded centered>
213205
{this.getCountiesToList().map(county => (
214-
<Table.Row key={county}>
215-
<Table.Cell>
216-
<div style={{ maxWidth: 150 }}>
217-
<Checkbox
218-
className="checkbox"
219-
label={county}
220-
onChange={() => this.toggleCheckbox(county)}
221-
checked={this.isChecked(county)}
222-
/>
223-
</div>
224-
</Table.Cell>
225-
<Table.Cell>
226-
<p>
227-
{numberWithCommas(this.state.countiesToCases[county])}
228-
</p>
229-
</Table.Cell>
230-
<Table.Cell>
231-
<p style={{ color: "green" }}>
232-
+{this.state.countiesToGrowth[county]}%
233-
</p>
234-
</Table.Cell>
235-
</Table.Row>
206+
<Grid.Column mobile={8} tablet={5} computer={3} key={county} className={this.isChecked(county) ? 'county-col': ''} >
207+
208+
<Button compact toggle active={this.isChecked(county)} onClick={() => this.toggleCheckbox(county)}>
209+
{county}
210+
<br/>
211+
<br/>
212+
<span className='light'>
213+
{`Cases: ${numberWithCommas(this.state.countiesToCases[county])} `}
214+
<br/>
215+
{`Weekly growth: +${this.state.countiesToGrowth[county]}%`}
216+
</span>
217+
</Button>
218+
219+
</Grid.Column>
236220
))}
237-
</Table.Body>
238-
</Table>
221+
</Grid>
222+
239223
</Grid.Row>
240224
</Grid>
241225
)}

yarn.lock

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9232,6 +9232,15 @@ query-string@^4.1.0:
92329232
object-assign "^4.1.0"
92339233
strict-uri-encode "^1.0.0"
92349234

9235+
query-string@^6.11.1:
9236+
version "6.13.0"
9237+
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.0.tgz#8d875f66581c854d7480ac79478abb847de742f6"
9238+
integrity sha512-KJe8p8EUcixhPCp4cJoTYVfmgKHjnAB/Pq3fiqlmyNHvpHnOL5U4YE7iI2PYivGHp4HFocWz300906BAQX0H7g==
9239+
dependencies:
9240+
decode-uri-component "^0.2.0"
9241+
split-on-first "^1.0.0"
9242+
strict-uri-encode "^2.0.0"
9243+
92359244
querystring-es3@^0.2.0:
92369245
version "0.2.1"
92379246
resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
@@ -10527,6 +10536,11 @@ spdy@^4.0.1:
1052710536
select-hose "^2.0.0"
1052810537
spdy-transport "^3.0.0"
1052910538

10539+
split-on-first@^1.0.0:
10540+
version "1.1.0"
10541+
resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f"
10542+
integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==
10543+
1053010544
split-string@^3.0.1, split-string@^3.0.2:
1053110545
version "3.1.0"
1053210546
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
@@ -10634,6 +10648,11 @@ strict-uri-encode@^1.0.0:
1063410648
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
1063510649
integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=
1063610650

10651+
strict-uri-encode@^2.0.0:
10652+
version "2.0.0"
10653+
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
10654+
integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY=
10655+
1063710656
string-length@^2.0.0:
1063810657
version "2.0.0"
1063910658
resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed"

0 commit comments

Comments
 (0)