-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HexInput component #18
Conversation
@molefrog Could you take a look? |
@molefrog I updated "Why react-colorful" section with:
Just wanted to mention that I polished the code to save bytes. Alternative text:
|
@omgovich Should be fine! |
(e) => { | ||
if (!validHex(e.target.value)) setValue(escape(color)); | ||
}, | ||
[color] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that's smart!
In case if the user needs to have a text field to type/paste HEX-color, he could import additional
HexInput
component which works well in pair with the picker and costs just 400 bytes:This component doesn't have any default styles. It's just an input with proper behavior. The developers could place and tweak this component any way they want.
BTW I noticed that ~33% of the
HexInput
's bundle size was the spread operator polyfill, so I usedReact.createElement("input", Object.assign({}, props, extraProps))
to fix that.How to test
npm run start-demo