This repository was archived by the owner on Apr 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Template } from './components/Template'
3
3
import { Box , Flex } from '@chakra-ui/react'
4
4
import { HelloWorld } from './components/HelloWorld'
5
5
import { Home } from './components/Home'
6
+ import { Counter } from './components/Counter'
6
7
7
8
function App ( ) {
8
9
return (
@@ -25,6 +26,9 @@ function App() {
25
26
< Link to = "/hello" color = "white" >
26
27
Hello
27
28
</ Link >
29
+ < Link to = "/counter" color = "white" >
30
+ Counter
31
+ </ Link >
28
32
</ Flex >
29
33
30
34
{ /* 各ページを表示するエリア */ }
@@ -33,6 +37,7 @@ function App() {
33
37
< Route path = "/" element = { < Home /> } />
34
38
< Route path = "/template" element = { < Template /> } />
35
39
< Route path = "/hello" element = { < HelloWorld /> } />
40
+ < Route path = "/counter" element = { < Counter /> } />
36
41
</ Routes >
37
42
</ Box >
38
43
</ Box >
Original file line number Diff line number Diff line change
1
+ import { useState } from "react" ;
2
+ import { Box , VStack , Text , Center } from "@chakra-ui/react" ;
3
+
4
+ export function Counter ( ) {
5
+ const [ count , setCount ] = useState ( 0 ) ;
6
+
7
+ return (
8
+ < Center h = "100vh" >
9
+ < VStack
10
+ w = "auto"
11
+ h = "auto"
12
+ padding = { '40px 80px' }
13
+ justifyContent = "center"
14
+ border = "1px solid white"
15
+ borderRadius = "10px"
16
+ gap = { '20px' }
17
+ >
18
+ < Text fontSize = "8xl" fontWeight = "bold" >
19
+ { count }
20
+ </ Text >
21
+ < Box
22
+ display = "flex"
23
+ justifyContent = "center"
24
+ alignItems = "center"
25
+ gap = "20px"
26
+ >
27
+ < button onClick = { ( ) => setCount ( count + 1 ) } >
28
+ < Text fontSize = "6xl" fontWeight = "bold" >
29
+ +
30
+ </ Text >
31
+ </ button >
32
+ < button onClick = { ( ) => setCount ( count - 1 ) } >
33
+ < Text fontSize = "6xl" fontWeight = "bold" >
34
+ -
35
+ </ Text >
36
+ </ button >
37
+ </ Box >
38
+ </ VStack >
39
+ </ Center >
40
+ ) ;
41
+ }
You can’t perform that action at this time.
0 commit comments