File tree 4 files changed +67
-9
lines changed 4 files changed +67
-9
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ export default class CodeGenerator extends React.Component {
41
41
*/
42
42
43
43
setLocalStorage ( ) {
44
- var color = JSON . stringify ( { color1 : this . state . color1 , color2 : this . state . color2 } )
45
- localStorage . setItem ( new Date ( ) . getTime ( ) , color ) ;
44
+ var color = JSON . stringify ( { color1 : this . state . color1 , color2 : this . state . color2 } ) ;
45
+ localStorage . setItem ( `gradient- ${ new Date ( ) . getTime ( ) } ` , color ) ;
46
46
}
47
47
48
48
generateRandom ( ) {
@@ -137,4 +137,4 @@ export default class CodeGenerator extends React.Component {
137
137
// 1. constructor
138
138
// 2. Component will mount
139
139
// 3. Component did mount
140
- // 4. component unmount
140
+ // 4. component unmount
Original file line number Diff line number Diff line change @@ -105,10 +105,13 @@ export default class Gradients extends React.Component {
105
105
loadUserColors ( ) {
106
106
userColors = [ ] ;
107
107
var colorKeys = Object . keys ( localStorage ) ;
108
+ colorKeys . sort ( ) . reverse ( ) ;
108
109
for ( var i = 0 ; i <= colorKeys . length - 1 ; i ++ ) {
109
110
let key = colorKeys [ i ] ;
110
- let value = localStorage . getItem ( key ) ;
111
- userColors . push ( { [ key ] : value } ) ;
111
+ if ( key . startsWith ( 'gradient-' ) ) {
112
+ let value = localStorage . getItem ( key ) ;
113
+ userColors . push ( { [ key ] : value } ) ;
114
+ }
112
115
}
113
116
var colors = getUserColors ( this . state . startIndex , this . state . limitColors ) ;
114
117
@@ -175,4 +178,4 @@ export default class Gradients extends React.Component {
175
178
</ div >
176
179
) ;
177
180
}
178
- }
181
+ }
Original file line number Diff line number Diff line change 5
5
.modify-controls {
6
6
display : flex;
7
7
justify-content : center;
8
- flex-wrap : wrap ;
8
+ align-items : center ;
9
9
}
10
10
11
11
.input-controls {
14
14
background : # 6c757d ;
15
15
border-radius : 5px ;
16
16
box-shadow : 0 5px 10px # 333 ;
17
+ max-width : 650px ;
18
+ display : flex;
19
+ }
20
+
21
+ .input-group .angle-range {
22
+ min-width : 200px ;
23
+ flex-wrap : nowrap;
24
+ }
25
+
26
+ .angle-range .form-control-range {
27
+ margin-left : 15px ;
17
28
}
18
29
19
30
.input-controls .input-group-text {
26
37
background : # 6c757d ;
27
38
border : none;
28
39
color : white;
29
- }
40
+ }
41
+
42
+ .angle-range-numeric {
43
+ min-width : 70px !important ;
44
+ text-align : center;
45
+ padding-right : 6px !important ;
46
+ }
47
+
48
+ .input-controls .input-group-prepend {
49
+ margin : 0 ;
50
+ }
51
+
52
+ @media (max-width : 950px ) {
53
+ .modify-controls {
54
+ flex-direction : column;
55
+ }
56
+ }
57
+
58
+ @media (max-width : 500px ) {
59
+ .input-controls .input-group : not (: last-child ) {
60
+ border-bottom : 1px solid # 444 ;
61
+ }
62
+ .input-controls {
63
+ flex-wrap : wrap;
64
+ max-width : 382px ;
65
+ }
66
+ .input-controls .input-group-text {
67
+ width : 148px ;
68
+ justify-content : center;
69
+ }
70
+ .input-controls .input-group-text {
71
+ border-radius : 0 ;
72
+ }
73
+ .input-controls # modify-color1 {
74
+ border-top-left-radius : 0.25rem ;
75
+ }
76
+ .input-controls # modify-angle {
77
+ border-bottom-left-radius : 0.25rem ;
78
+ }
79
+ }
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ export default class Modify extends React.Component {
86
86
value = { this . state . HEX_1 }
87
87
onChange = { ( e ) => { this . changeColor1 ( e ) } }
88
88
/>
89
+ </ InputGroup >
90
+ < InputGroup >
89
91
< InputGroup . Prepend >
90
92
< InputGroup . Text id = "modify-color2" > Color-2</ InputGroup . Text >
91
93
</ InputGroup . Prepend >
@@ -94,6 +96,8 @@ export default class Modify extends React.Component {
94
96
value = { this . state . HEX_2 }
95
97
onChange = { ( e ) => { this . changeColor2 ( e ) } }
96
98
/>
99
+ </ InputGroup >
100
+ < InputGroup className = "angle-range" >
97
101
< InputGroup . Prepend >
98
102
< InputGroup . Text id = "modify-angle" > Angle</ InputGroup . Text >
99
103
</ InputGroup . Prepend >
@@ -105,6 +109,7 @@ export default class Modify extends React.Component {
105
109
onChange = { ( e ) => { this . changeAngle ( e ) } }
106
110
/>
107
111
< FormControl
112
+ className = "angle-range-numeric"
108
113
type = "number"
109
114
min = "0"
110
115
max = "360"
@@ -139,4 +144,4 @@ export default class Modify extends React.Component {
139
144
</ div >
140
145
) ;
141
146
}
142
- }
147
+ }
You can’t perform that action at this time.
0 commit comments