Commit 0b2e001 1 parent 2f13d6e commit 0b2e001 Copy full SHA for 0b2e001
File tree 2 files changed +60
-32
lines changed
2 files changed +60
-32
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ import { EventCreator } from "@/components/event-creator";
47
47
import { Event , Todo , StickyNote } from "@/components/types" ;
48
48
import { priorityColors } from "@/components/priority-colors" ;
49
49
import { Navigation } from "@/components/navigation" ;
50
+ import { EditWantodoDialog } from "@/components/edit-wantodo-dialog" ;
50
51
51
52
export default function Home ( ) {
52
53
const [ todos ] = useState < Todo [ ] > ( [ ] ) ;
@@ -607,38 +608,11 @@ export default function Home() {
607
608
) }
608
609
</ AnimatePresence >
609
610
610
- < Dialog
611
- open = { ! ! editingStickyNote }
612
- onOpenChange = { ( ) => setEditingStickyNote ( null ) }
613
- >
614
- < DialogContent >
615
- < DialogHeader >
616
- < DialogTitle > wanTODOを編集</ DialogTitle >
617
- </ DialogHeader >
618
- { editingStickyNote && (
619
- < div className = "space-y-4" >
620
- < Input
621
- type = "text"
622
- value = { editingStickyNote . title }
623
- onChange = { ( e ) =>
624
- setEditingStickyNote ( {
625
- ...editingStickyNote ,
626
- title : e . target . value ,
627
- } )
628
- }
629
- placeholder = "タイトルを入力"
630
- />
631
- < Button
632
- onClick = { ( ) =>
633
- editingStickyNote && updateStickyNote ( editingStickyNote )
634
- }
635
- >
636
- 更新
637
- </ Button >
638
- </ div >
639
- ) }
640
- </ DialogContent >
641
- </ Dialog >
611
+ < EditWantodoDialog
612
+ editingStickyNote = { editingStickyNote }
613
+ setEditingStickyNote = { setEditingStickyNote }
614
+ updateStickyNote = { updateStickyNote }
615
+ />
642
616
643
617
< Dialog open = { isEventModalOpen } onOpenChange = { setIsEventModalOpen } >
644
618
< DialogContent className = "max-w-3xl" >
Original file line number Diff line number Diff line change
1
+ "use client" ;
2
+
3
+ import { Button } from "@/components/ui/button" ;
4
+ import {
5
+ Dialog ,
6
+ DialogContent ,
7
+ DialogHeader ,
8
+ DialogTitle ,
9
+ } from "@/components/ui/dialog" ;
10
+ import { Input } from "@/components/ui/input" ;
11
+ import { StickyNote } from "./types" ;
12
+
13
+ type Props = {
14
+ editingStickyNote : StickyNote | null ;
15
+ setEditingStickyNote : ( stickyNote : StickyNote | null ) => void ;
16
+ updateStickyNote : ( stickyNote : StickyNote ) => void ;
17
+ }
18
+
19
+ export function EditWantodoDialog ( { editingStickyNote, setEditingStickyNote, updateStickyNote } : Props ) {
20
+ return (
21
+ < Dialog
22
+ open = { ! ! editingStickyNote }
23
+ onOpenChange = { ( ) => setEditingStickyNote ( null ) }
24
+ >
25
+ < DialogContent >
26
+ < DialogHeader >
27
+ < DialogTitle > wanTODOを編集</ DialogTitle >
28
+ </ DialogHeader >
29
+ { editingStickyNote && (
30
+ < div className = "space-y-4" >
31
+ < Input
32
+ type = "text"
33
+ value = { editingStickyNote . title }
34
+ onChange = { ( e ) =>
35
+ setEditingStickyNote ( {
36
+ ...editingStickyNote ,
37
+ title : e . target . value ,
38
+ } )
39
+ }
40
+ placeholder = "タイトルを入力"
41
+ />
42
+ < Button
43
+ onClick = { ( ) =>
44
+ editingStickyNote && updateStickyNote ( editingStickyNote )
45
+ }
46
+ >
47
+ 更新
48
+ </ Button >
49
+ </ div >
50
+ ) }
51
+ </ DialogContent >
52
+ </ Dialog >
53
+ )
54
+ }
You can’t perform that action at this time.
0 commit comments