Skip to content

Commit d2d02d1

Browse files
committed
fmt with changelog
1 parent f086a0a commit d2d02d1

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
dist
22
coverage
33
node_modules
4+
storybook-static

CHANGELOG.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# Changelog
1+
# CHANGELOG
22

3-
All notable changes to this project will be documented in this file.
3+
## [Unreleased]
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
## 3.0.1
76

8-
## [Unreleased]
7+
- fix updating with hex input [#45](https://github.com/swiftcarrot/react-input-color/pull/45)
98

109
## 3.0.0
1110

src/color-picker.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
rgb2hex,
99
hex2rgb,
1010
rgba,
11-
hsv2rgb
11+
hsv2rgb,
1212
} from '@swiftcarrot/color-fns';
1313

1414
const KEY_ENTER = 13;
@@ -39,8 +39,8 @@ const ColorPicker = ({ color, onChange }) => {
3939
}
4040

4141
function changeHex(hex) {
42-
const {r, g, b} = hex2rgb(hex);
43-
const {h, s, v} = rgb2hsv(r, g, b);
42+
const { r, g, b } = hex2rgb(hex);
43+
const { h, s, v } = rgb2hsv(r, g, b);
4444
changeColor({ ...color, r, g, b, h, s, v, hex });
4545
}
4646

@@ -82,8 +82,8 @@ const ColorPicker = ({ color, onChange }) => {
8282
height: 12,
8383
backgroundColor: 'rgba(0,0,0,0)',
8484
border: '2px solid #fff',
85-
borderRadius: '50%'
86-
}
85+
borderRadius: '50%',
86+
},
8787
}}
8888
/>
8989
</div>
@@ -93,7 +93,7 @@ const ColorPicker = ({ color, onChange }) => {
9393
width: '100%',
9494
marginTop: 10,
9595
marginBottom: 10,
96-
display: 'flex'
96+
display: 'flex',
9797
}}
9898
>
9999
<div css={{ flex: 1, marginRight: 10 }}>
@@ -108,17 +108,17 @@ const ColorPicker = ({ color, onChange }) => {
108108
height: 12,
109109
borderRadius: 0,
110110
background:
111-
'linear-gradient(to left, #FF0000 0%, #FF0099 10%, #CD00FF 20%, #3200FF 30%, #0066FF 40%, #00FFFD 50%, #00FF66 60%, #35FF00 70%, #CDFF00 80%, #FF9900 90%, #FF0000 100%)'
111+
'linear-gradient(to left, #FF0000 0%, #FF0099 10%, #CD00FF 20%, #3200FF 30%, #0066FF 40%, #00FFFD 50%, #00FF66 60%, #35FF00 70%, #CDFF00 80%, #FF9900 90%, #FF0000 100%)',
112112
},
113113
active: {
114-
background: 'none'
114+
background: 'none',
115115
},
116116
thumb: {
117117
width: 5,
118118
height: 14,
119119
borderRadius: 0,
120-
backgroundColor: '#eee'
121-
}
120+
backgroundColor: '#eee',
121+
},
122122
}}
123123
/>
124124
<InputSlider
@@ -130,17 +130,17 @@ const ColorPicker = ({ color, onChange }) => {
130130
width: '100%',
131131
height: 12,
132132
borderRadius: 0,
133-
background: opacityGradient
133+
background: opacityGradient,
134134
},
135135
active: {
136-
background: 'none'
136+
background: 'none',
137137
},
138138
thumb: {
139139
width: 5,
140140
height: 14,
141141
borderRadius: 0,
142-
backgroundColor: '#eee'
143-
}
142+
backgroundColor: '#eee',
143+
},
144144
}}
145145
onChange={({ x }) => changeAlpha(x)}
146146
/>
@@ -156,7 +156,7 @@ const ColorPicker = ({ color, onChange }) => {
156156
style={{ width: 70, textAlign: 'left' }}
157157
type="text"
158158
value={color.hex}
159-
onChange={e => changeHex(e.target.value)}
159+
onChange={(e) => changeHex(e.target.value)}
160160
onKeyUp={handleHexKeyUp}
161161
/>
162162
<div>Hex</div>
@@ -167,7 +167,7 @@ const ColorPicker = ({ color, onChange }) => {
167167
min={0}
168168
max={255}
169169
value={r}
170-
onChange={r => changeRGB(r, g, b)}
170+
onChange={(r) => changeRGB(r, g, b)}
171171
/>
172172
<div>R</div>
173173
</div>
@@ -176,7 +176,7 @@ const ColorPicker = ({ color, onChange }) => {
176176
min={0}
177177
max={255}
178178
value={g}
179-
onChange={g => changeRGB(r, g, b)}
179+
onChange={(g) => changeRGB(r, g, b)}
180180
/>
181181
<div>G</div>
182182
</div>
@@ -185,7 +185,7 @@ const ColorPicker = ({ color, onChange }) => {
185185
min={0}
186186
max={255}
187187
value={b}
188-
onChange={b => changeRGB(r, g, b)}
188+
onChange={(b) => changeRGB(r, g, b)}
189189
/>
190190
<div>B</div>
191191
</div>
@@ -195,7 +195,7 @@ const ColorPicker = ({ color, onChange }) => {
195195
min={0}
196196
max={100}
197197
value={a}
198-
onChange={a => changeAlpha(a)}
198+
onChange={(a) => changeAlpha(a)}
199199
/>
200200
<div>A</div>
201201
</div>
@@ -205,7 +205,7 @@ const ColorPicker = ({ color, onChange }) => {
205205
};
206206

207207
ColorPicker.defaultProps = {
208-
initialValue: '#5e72e4'
208+
initialValue: '#5e72e4',
209209
};
210210

211211
const styles = {
@@ -214,14 +214,14 @@ const styles = {
214214
width: 230,
215215

216216
'*': {
217-
userSelect: 'none'
218-
}
217+
userSelect: 'none',
218+
},
219219
},
220220

221221
selector: {
222222
position: 'relative',
223223
width: 230,
224-
height: 230
224+
height: 230,
225225
},
226226

227227
gradientWhite: {
@@ -231,7 +231,7 @@ const styles = {
231231
right: 0,
232232
bottom: 0,
233233
background:
234-
'linear-gradient(to right, #ffffff 0%, rgba(255, 255, 255, 0) 100%)'
234+
'linear-gradient(to right, #ffffff 0%, rgba(255, 255, 255, 0) 100%)',
235235
},
236236

237237
gradientDark: {
@@ -240,13 +240,13 @@ const styles = {
240240
left: 0,
241241
right: 0,
242242
bottom: 0,
243-
background: 'linear-gradient(to bottom, transparent 0%, #000000 100%)'
243+
background: 'linear-gradient(to bottom, transparent 0%, #000000 100%)',
244244
},
245245

246246
inputs: {
247247
display: 'flex',
248248
justifyContent: 'space-between',
249-
width: '100%'
249+
width: '100%',
250250
},
251251

252252
input: {
@@ -257,13 +257,13 @@ const styles = {
257257

258258
input: {
259259
width: 30,
260-
textAlign: 'center'
260+
textAlign: 'center',
261261
},
262262

263263
div: {
264-
marginTop: 4
265-
}
266-
}
264+
marginTop: 4,
265+
},
266+
},
267267
};
268268

269269
export default ColorPicker;

0 commit comments

Comments
 (0)