Skip to content

Commit 61c8b3b

Browse files
Yair Even OrYair Even Or
Yair Even Or
authored and
Yair Even Or
committed
fixed typo and added some more comments to the code example
1 parent 8a041e1 commit 61c8b3b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const cPicker = new ColorPicker({
8686
onInput(color){},
8787

8888
// like "onInput", but not fired while a range slider is moved
89-
onChnage(color){},
89+
onChange(color){},
9090

9191
// helpful when the component is used as a popup
9292
onClickOutside(e){}
@@ -110,15 +110,19 @@ is being changes, so will the other input.
110110
```
111111

112112
```js
113-
position = position.default; // only because "@yaireo/position" is used as a script file and not an node module (ES export)
113+
// because "@yaireo/position" is used (in this demo) as a script file and not an node module (ES export)
114+
position = position.default;
114115

115116
const cPicker = new ColorPicker({
116117
color: myColor.value, // use the input element's value
117118

118-
className: 'hidden', // start as hidden
119+
className: 'hidden', // optional class name which will be added to the color-picker component
119120

120121
swatches: ['white', '#000', 'rgba(255,0,0,.3)'],
121122

123+
// when clicking anywhere that is not within the color picker.
124+
// use special logic if clicked on the color-input which is
125+
// assosiacated with this specific picker
122126
onClickOutside(e){
123127
let action = 'add',
124128
isTargetColorInput = e.target == myColor

0 commit comments

Comments
 (0)