質問編集履歴

1

InputTodo.jsxを追記しました。

2021/07/03 02:38

投稿

kimch
kimch

スコア8

test CHANGED
File without changes
test CHANGED
@@ -12,8 +12,206 @@
12
12
 
13
13
  # 該当ソースコード
14
14
 
15
+
16
+
15
17
  ```react
16
18
 
19
+ InputTodo.jsx
20
+
21
+
22
+
23
+ import React from 'react';
24
+
25
+ import { useState } from 'react';
26
+
27
+ import styled from 'styled-components';
28
+
29
+ import TodoStatus from './TodoStatus';
30
+
31
+
32
+
33
+ export const InputTodo =(props)=>{
34
+
35
+ const { onClickAdd, disabled} = props;
36
+
37
+
38
+
39
+ const [todoTitle,setTodoTitle]= useState("");
40
+
41
+ const [todoText,setTodoText]= useState("");
42
+
43
+ const [todoLimit,setTodoLimit]= useState("");
44
+
45
+ const [todoStatus,setTodoStatus]= useState("");
46
+
47
+
48
+
49
+
50
+
51
+ const onChangeTitleValue = (e)=>setTodoTitle(e.target.value);
52
+
53
+ const onChangeTextValue = (e)=>setTodoText(e.target.value);
54
+
55
+ const onChangeLimitValue = (e)=>setTodoLimit(e.target.value);
56
+
57
+
58
+
59
+ return(
60
+
61
+ <>
62
+
63
+ <INputBlock>
64
+
65
+ <INputArea>
66
+
67
+ <TItle>入力してください</TItle>
68
+
69
+ <INputTag autoFocus disabled={disabled} placeholder="titleを入力してください" value={todoTitle} onChange={onChangeTitleValue}></INputTag>
70
+
71
+ </INputArea>
72
+
73
+ <INputArea>
74
+
75
+ <TExtArea disabled={disabled} placeholder="todoを入力してください" value={todoText} onChange={onChangeTextValue}></TExtArea>
76
+
77
+ </INputArea>
78
+
79
+ <INputArea>
80
+
81
+ <INputTag disabled={disabled} placeholder="limitを入力してください" value={todoLimit} onChange={onChangeLimitValue}></INputTag>
82
+
83
+ <br />
84
+
85
+ <TodoStatus todoStatus={todoStatus} setTodoStatus={setTodoStatus}/>
86
+
87
+ <BUtton disabled={disabled} onClick={()=>{
88
+
89
+ onClickAdd(todoTitle,todoText,todoLimit, todoStatus)
90
+
91
+ setTodoTitle('')
92
+
93
+ setTodoText('')
94
+
95
+ setTodoLimit('')
96
+
97
+ setTodoStatus("未着手")
98
+
99
+
100
+
101
+ }} >追加</BUtton>
102
+
103
+
104
+
105
+ </INputArea>
106
+
107
+ </INputBlock>
108
+
109
+ </>
110
+
111
+ )
112
+
113
+ };
114
+
115
+
116
+
117
+ const INputBlock = styled.div`
118
+
119
+ background-color: rgb(202, 211, 39);
120
+
121
+ width: 80%;
122
+
123
+ border-radius: 20px;
124
+
125
+ padding-bottom:10px;
126
+
127
+ `
128
+
129
+
130
+
131
+ const INputArea = styled.div`
132
+
133
+ margin: 20px;
134
+
135
+ `
136
+
137
+
138
+
139
+ const TItle = styled.p`
140
+
141
+ text-align: center;
142
+
143
+ font-size: 25px;
144
+
145
+ font-weight: bold;
146
+
147
+ color: #666;
148
+
149
+ `
150
+
151
+
152
+
153
+ const INputTag = styled.input`
154
+
155
+ border-radius: 20px;
156
+
157
+ border: none;
158
+
159
+ padding: 6px 20px;
160
+
161
+ outline:none
162
+
163
+ `
164
+
165
+ const TExtArea = styled.textarea`
166
+
167
+ border-radius: 20px;
168
+
169
+ border: none;
170
+
171
+ height: 80px;
172
+
173
+ width: 80%;
174
+
175
+ padding: 20px 20px;
176
+
177
+ outline:none
178
+
179
+ font-weight: bold;
180
+
181
+ `
182
+
183
+
184
+
185
+ const BUtton = styled.button`
186
+
187
+ border-radius: 20px;
188
+
189
+ border: none;
190
+
191
+ margin: 3px 5px 6px 3px;
192
+
193
+ spacing: 4;
194
+
195
+ &:hover{
196
+
197
+ border-radius: 20px;
198
+
199
+ border: none;
200
+
201
+ background-color: blueviolet;
202
+
203
+ color: white;
204
+
205
+ cursor: pointer;
206
+
207
+ }
208
+
209
+ `
210
+
211
+ ```
212
+
213
+ ```react
214
+
17
215
  IncompleteTodos.jsx
18
216
 
19
217