@@ -3,7 +3,8 @@ import styled from "styled-components";
3
3
import { compose , withState , withHandlers } from "recompose" ;
4
4
import Button from "@material-ui/core/Button" ;
5
5
import Delete from "@material-ui/icons/Delete" ;
6
- import ColorLens from "@material-ui/icons/ColorLens" ;
6
+
7
+ import ColourPicker from "./ColourPicker" ;
7
8
8
9
const StyledButton = styled ( Button ) `
9
10
position: absolute !important;
@@ -15,44 +16,13 @@ const Postit = styled.li`
15
16
color: #333;
16
17
position: relative;
17
18
width: 300px;
19
+ min-height: 300px;
18
20
margin: 0 auto;
19
21
transform: rotate(2deg);
20
22
padding: 40px 0 0 40px;
21
23
box-shadow: 0 10px 10px 2px rgba(0, 0, 0, 0.3);
22
24
` ;
23
- const ToggleListButton = styled ( Button ) `
24
- position: absolute !important;
25
- bottom: 10px;
26
- left: 10px;
27
- ` ;
28
25
29
- const ColourPicker = styled . ul `
30
- list-style: none;
31
- padding: 0;
32
- margin: 0;
33
- z-index: 12;
34
- ` ;
35
- const ColourOffering = styled . li `
36
- border-radius: 50%;
37
- height: 56px;
38
- width: 56px;
39
- background: blue;
40
- position: absolute;
41
- text-indent: 100%;
42
- overflow: hidden;
43
- ` ;
44
- const ColourOfferingYellow = ColourOffering . extend `
45
- background: yellow;
46
- left: 0;
47
- ` ;
48
- const ColourOfferingGreen = ColourOffering . extend `
49
- background: green;
50
- left: 30px;
51
- ` ;
52
- const ColourOfferingPink = ColourOffering . extend `
53
- background: pink;
54
- left: 60px;
55
- ` ;
56
26
const Textarea = styled . textarea `
57
27
border: none;
58
28
background: none;
@@ -68,7 +38,6 @@ const Posit = ({
68
38
setPostitColour,
69
39
removeNote,
70
40
toggleColourPicker,
71
- isColorPickerShown,
72
41
isPostitActive,
73
42
handleInputChange,
74
43
highLightPostit
@@ -96,41 +65,18 @@ const Posit = ({
96
65
>
97
66
< Delete />
98
67
</ StyledButton >
99
- < ToggleListButton
100
- onClick = { ( ) => toggleColourPicker ( ! isColorPickerShown ) }
101
- title = "change color"
102
- color = "primary"
103
- aria-label = "change color"
104
- variant = "fab"
105
- >
106
- < ColorLens />
107
- </ ToggleListButton >
108
- { isColorPickerShown && (
109
- < ColourPicker >
110
- < ColourOfferingYellow onClick = { ( ) => setPostitColour ( "yellow" ) } >
111
- yellow
112
- </ ColourOfferingYellow >
113
- < ColourOfferingGreen onClick = { ( ) => setPostitColour ( "green" ) } >
114
- green
115
- </ ColourOfferingGreen >
116
- < ColourOfferingPink onClick = { ( ) => setPostitColour ( "pink" ) } >
117
- pink
118
- </ ColourOfferingPink >
119
- </ ColourPicker >
120
- ) }
68
+ < ColourPicker
69
+ setPostitColour = { setPostitColour }
70
+ toggleColourPicker = { toggleColourPicker }
71
+ />
121
72
</ Postit >
122
73
) ;
123
74
} ;
124
75
const enhance = compose (
125
- withState ( "isColorPickerShown" , "toggleColourPicker" , false ) ,
126
76
withState ( "isPostitActive" , "highLightPostit" , false ) ,
127
77
withHandlers ( {
128
- setPostitColour : props => colour => {
129
- props . updateNoteColour ( { id : props . note . id , noteColour : colour } ) ;
130
- props . toggleColourPicker ( ) ;
131
- } ,
132
78
handleInputChange : props => event => {
133
- props . updateNoteText ( { id : props . note . id , noteText : event . value } ) ;
79
+ props . updateNoteText ( { id : props . note . id , noteText : event . target . value } ) ;
134
80
} ,
135
81
highLightPostIt : props => event => { }
136
82
} )
0 commit comments