-
Notifications
You must be signed in to change notification settings - Fork 26
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
Redo MoneyInput (better UX, less error cases) #175
Conversation
Tests are failing. I'll rewrite them with |
Note to self: We should add |
7e79a55
to
3e9aee8
Compare
New tests with I skipped converting the tests related to styling as testing classnames doesn't seem like the right way for this anyways. |
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.
The UX simplification is real nice. Maybe there is one mistake in the docs. Not sure.
BREAKING CHANGE: dropped support for hasAmountError, hasAmountWarning, hasCurrencyError and hasCurrencyWarning. Use hasError and hasWarning instead. BREAKING CHANGE: isTouched only returns true when both fields were touched from now on.
… focus We only mark both as blurred when an element which is not part of the MoneyInput gains focus. This is done to ensure the MoneyInput acts as one unit so that errors can be displayed correctly (as they rely on both touched states and would pop up too early if only one of them is checked). This also auto-focuses the amount intput after a currency has been selected.
c9b6b32
to
e1c2025
Compare
The old
MoneyInput
was capable of displaying an error either on the currency dropdown or the amount input:hasCurrencyError
hasAmountError
After talking to @filippobocik we agreed to drop the individual error states from
MoneyInput
.MoneyInput
will now only accepthasError
(andhasWarning
) instead ofhasCurrencyError
andhasAmountError
.This makes the code easier for consumers as they only need to worry about one error state and they don't need to worry about individual
touched
states anymore to display the errors in the right cases.Old
MoneyInput
in a formMoneyInput
. It pops up before the user has a chance to type the amount.New
MoneyInput
in a formMoneyInput
completelyPlay with it https://deploy-preview-175--mc-uikit.netlify.com/?selectedKind=Examples%7CForms%2FInputs&selectedStory=MoneyInput&full=0&addons=1&stories=1&panelRight=1&addonPanel=storybook%2Factions%2Factions-panel.