-
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
docs: fix money input stories and docs #91
Conversation
} else if (MoneyInput.isHighPrecision(formValues.price)) { | ||
errors.price.unsupportedHighPrecision = true; | ||
} | ||
|
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.
Just reordered to be in line with the rest of the document.
@@ -7,7 +7,7 @@ A controlled input component for money values with validation states. | |||
## Usage | |||
|
|||
```js | |||
import MoneyInput from '@commercetools-frontend/ui-kit/inputs/money-input'; | |||
import { MoneyInput } from '@commercetools-frontend/ui-kit'; |
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.
Fixed import path. See #90.
| `isDisabled` | `bool` | - | - | `false` | Indicates that the field cannot be used. | | ||
| `onBlur` | `func` | - | - | - | Called when the amount field or the currency code dropdown is blurred. | | ||
| `onChange` | `function(event)` | ✳️ | - | - | Called with the event of the input or dropdown when either the currency or the amount have changed. Either `onChange` or `onChangeValue` must be passed. | | ||
| `onChangeValue` | `function(nextValue: { currencyCode: string, amount: string })` | ✳️ | - | - | Called with the full value when either the currency or the amount have changed. Either `onChange` or `onChangeValue` must be passed. | |
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.
onChangeValue
This does no longer exist and was removed. onChange
was adapted as well.
@@ -218,6 +218,8 @@ export default class MoneyInput extends React.Component { | |||
return moneyValue && moneyValue.type === 'highPrecision'; | |||
}; | |||
|
|||
static isTouched = touched => touched && Object.values(touched).some(Boolean); |
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.
Moved it up so that all static methods used by consumers are grouped at the top.
} else if (event.target.name.endsWith('.currencyCode')) { | ||
({ ...value, currencyCode: event.target.value }); | ||
} | ||
}; |
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.
This fixes the story.
* docs(money-input): fix stories * docs(money-input): remove onChangeValue, fix onChange
The
money-input
story was broken. This PR fixes it.It further fixes the docs.