This repository was archived by the owner on Aug 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.tsx
More file actions
117 lines (110 loc) · 2.77 KB
/
index.tsx
File metadata and controls
117 lines (110 loc) · 2.77 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import { css } from "@linaria/core";
import * as Highcharts from "highcharts";
import { HighchartsReact } from "highcharts-react-official";
import { useIndex } from "./index.hook";
import { Checkbox } from "@/components/ui/Checkbox";
import { RadioButton } from "@/components/ui/RadioButton";
export const Index = () => {
const {
prefectures,
labels,
targetDataIndex,
highchartsOptions,
chartComponentRef,
handleChangeCheckedCode,
handleChangeTargetDataIndex,
} = useIndex();
return (
<div
className={css`
margin: 16px;
`}
>
<h1>population-graph-app</h1>
<div
className={css`
margin-top: 32px;
`}
>
<h2
className={css`
font-size: 18px;
`}
>
都道府県を選択してください(複数可)
</h2>
<div
className={css`
display: grid;
grid-template-columns: repeat(auto-fit, minmax(91px, 1fr));
gap: 8px;
margin-top: 8px;
`}
>
{prefectures.map((prefecture) => {
const { prefCode, prefName, checked } = prefecture;
return (
<Checkbox
key={prefCode}
id={`checkbox_pref_${prefCode}`}
checked={checked}
value={prefCode}
onChange={handleChangeCheckedCode}
className={css`
font-size: 12px;
`}
>
{prefName}
</Checkbox>
);
})}
</div>
</div>
<div
className={css`
margin-top: 32px;
`}
>
<h2
className={css`
font-size: 18px;
`}
>
表示するデータを選択してください
</h2>
<div
className={css`
display: grid;
grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
gap: 8px;
margin-top: 8px;
`}
>
{labels.map((label) => {
const { index, name } = label;
return (
<RadioButton
key={index}
value={index}
checked={targetDataIndex === index}
onChange={handleChangeTargetDataIndex}
className={css`
font-size: 12px;
`}
>
{name}
</RadioButton>
);
})}
</div>
</div>
<div
className={css`
margin-top: 32px;
`}
>
<HighchartsReact highcharts={Highcharts} options={highchartsOptions} ref={chartComponentRef} />
</div>
</div>
);
};