Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87c5831

Browse files
added onchange priority
1 parente34120f commit87c5831

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
.add-noteinput{
22
line-height:2rem;
3-
width:80%;
3+
width:60%;
44
}
55
.add-notebutton{
66
line-height:2rem;
77
width:15%;
8+
}
9+
10+
.add-noteselect{
11+
line-height:2rem;
12+
width:20%;
13+
height:2rem;
814
}

‎src/components/add-note/add-note.tsx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import{useState}from'react';
2-
import{NoteType}from'../note/note-type';
2+
import{NoteType,Priority}from'../note/note-type';
33
import'./add-note.css';
44
import{v4asuuidv4}from'uuid';
55

@@ -10,6 +10,7 @@ type AddNoteProps = {
1010
functionAddNote(props:AddNoteProps){
1111

1212
const[text,setText]=useState("");
13+
const[priority,setPriority]=useState<Priority>('low');
1314
consthandleChange=(e:React.ChangeEvent<HTMLInputElement>)=>{
1415
setText(e.target.value);
1516
}
@@ -18,15 +19,24 @@ function AddNote(props: AddNoteProps){
1819
e.preventDefault();
1920
props.addNote({
2021
text,
21-
priority:'low',
22+
priority,
2223
id:uuidv4()
2324
})
2425
}
2526

27+
consthandleSelect=(e:React.ChangeEvent<HTMLSelectElement>)=>{
28+
setPriority(e.target.valueasPriority);
29+
}
30+
2631
return(
2732
<div>
2833
<formclassName="add-note">
2934
<inputtype="text"onChange={handleChange}/>
35+
<selectonChange={handleSelect}value={priority}>
36+
<optionvalue="high">High</option>
37+
<optionvalue="medium">Medium</option>
38+
<optionvalue="low">Low</option>
39+
</select>
3040
<buttononClick={handleClick}>Add</button>
3141
</form>
3242
</div>

‎src/components/note/note-type.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
exporttypePriority='high'|'medium'|'low';
2+
13
exporttypeNoteProps={
24
text:string,
3-
priority? :'high'|'medium'|'low'
5+
priority? :Priority
46
}
57

68
exporttypeNoteType={
79
id:string,
810
text:string,
9-
priority :'high'|'medium'|'low'
11+
priority :Priority
1012
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp