Skip to content

Commit 2287c16

Browse files
committed
Added basic logic for up and down <button>s for incrementing / decrementing the values of the color components.
1 parent d639647 commit 2287c16

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

webpack_in/entry.jsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,24 @@ class ColorComponentEntry extends React.Component {
276276

277277
this.props.onChangeValue(convertValue(strValueEntered));
278278
}} />
279+
<button onClick={ () => {
280+
const valueNew = this.props.value + 1;
281+
282+
if (valueNew > 255) {
283+
return;
284+
}
285+
286+
this.props.onChangeValue(valueNew);
287+
}}>&#9650;</button>
288+
<button onClick={ () => {
289+
const valueNew = this.props.value - 1;
290+
291+
if (valueNew < 0) {
292+
return;
293+
}
294+
295+
this.props.onChangeValue(valueNew);
296+
}}>&#9660;</button>
279297
</div>
280298
);
281299
}

0 commit comments

Comments
 (0)