Skip to content

Commit e0e9d27

Browse files
committed
resolved modify screen error and design
1 parent ac1cc44 commit e0e9d27

File tree

4 files changed

+67
-9
lines changed

4 files changed

+67
-9
lines changed

src/components/codegenerator/codegenerator.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export default class CodeGenerator extends React.Component {
4141
*/
4242

4343
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);
4646
}
4747

4848
generateRandom() {
@@ -137,4 +137,4 @@ export default class CodeGenerator extends React.Component {
137137
// 1. constructor
138138
// 2. Component will mount
139139
// 3. Component did mount
140-
// 4. component unmount
140+
// 4. component unmount

src/components/gradients/gradients.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,13 @@ export default class Gradients extends React.Component {
105105
loadUserColors() {
106106
userColors = [];
107107
var colorKeys = Object.keys(localStorage);
108+
colorKeys.sort().reverse();
108109
for (var i = 0; i <= colorKeys.length - 1; i++) {
109110
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+
}
112115
}
113116
var colors = getUserColors(this.state.startIndex, this.state.limitColors);
114117

@@ -175,4 +178,4 @@ export default class Gradients extends React.Component {
175178
</div>
176179
);
177180
}
178-
}
181+
}

src/components/modify/modify.css

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.modify-controls {
66
display: flex;
77
justify-content: center;
8-
flex-wrap: wrap;
8+
align-items: center;
99
}
1010

1111
.input-controls {
@@ -14,6 +14,17 @@
1414
background: #6c757d;
1515
border-radius: 5px;
1616
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;
1728
}
1829

1930
.input-controls .input-group-text {
@@ -26,4 +37,43 @@
2637
background: #6c757d;
2738
border: none;
2839
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+
}

src/components/modify/modify.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export default class Modify extends React.Component {
8686
value={this.state.HEX_1}
8787
onChange={(e) => { this.changeColor1(e) }}
8888
/>
89+
</InputGroup>
90+
<InputGroup>
8991
<InputGroup.Prepend>
9092
<InputGroup.Text id="modify-color2">Color-2</InputGroup.Text>
9193
</InputGroup.Prepend>
@@ -94,6 +96,8 @@ export default class Modify extends React.Component {
9496
value={this.state.HEX_2}
9597
onChange={(e) => { this.changeColor2(e) }}
9698
/>
99+
</InputGroup>
100+
<InputGroup className="angle-range">
97101
<InputGroup.Prepend>
98102
<InputGroup.Text id="modify-angle">Angle</InputGroup.Text>
99103
</InputGroup.Prepend>
@@ -105,6 +109,7 @@ export default class Modify extends React.Component {
105109
onChange={(e) => { this.changeAngle(e) }}
106110
/>
107111
<FormControl
112+
className="angle-range-numeric"
108113
type="number"
109114
min="0"
110115
max="360"
@@ -139,4 +144,4 @@ export default class Modify extends React.Component {
139144
</div>
140145
);
141146
}
142-
}
147+
}

0 commit comments

Comments
 (0)