-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling styles for errors/warnings in localized inputs and f…
…ields (#2732) * refactor(fields): update localized fields error messages handling * refactor(inputs): update localized fields error and warning messages handling * chore: add changesets * chore: fix type in changesets * fix(localized-money-input): add missing dependency * fix(components): remove unused imports * fix(changeset): fix changeset code snippet * fix: fix changeset level * fix: fix changesel * refactor(components): update vrts * fix(localized-text-input): fix spacing issue
- Loading branch information
1 parent
e0038e4
commit de3776d
Showing
19 changed files
with
129 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
'@commercetools-uikit/localized-multiline-text-input': minor | ||
'@commercetools-uikit/localized-rich-text-input': minor | ||
'@commercetools-uikit/localized-money-input': minor | ||
'@commercetools-uikit/localized-text-input': minor | ||
--- | ||
|
||
We've changed how we internally manage the `errors` and `warnings` properties to make it easy for consumers to style them. | ||
|
||
If you currently want to render an error for an specific language, you need to use the `WarningMessage` component to wrap the error text you provide to the component: | ||
|
||
```jsx | ||
<LocalizexTextInput | ||
title="Title" | ||
value={value} | ||
onChange={handleChange} | ||
warnings={{ | ||
en: <WarningMessage>This is a warning</WarningMessage>, | ||
}} | ||
> | ||
``` | ||
|
||
With the new update, you no longer need to wrap the error text so you can provide it as it is: | ||
|
||
```jsx | ||
<LocalizexTextInput | ||
title="Title" | ||
value={value} | ||
onChange={handleChange} | ||
warnings={{ | ||
en: 'This is a warning', | ||
}} | ||
> | ||
``` | ||
|
||
We still support the former, but we encourage using the new way to provide errors and warnings. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
'@commercetools-uikit/localized-multiline-text-field': minor | ||
'@commercetools-uikit/localized-text-field': minor | ||
--- | ||
|
||
We've changed how we internally manage the `errorsByLanguage` property to make it easy for consumers to style them. | ||
|
||
If you currently want to render an error for an specific language, you need to use the `ErrorMessage` component to wrap the error text you provide to the component: | ||
|
||
```jsx | ||
<LocalizedTextField | ||
title="Title" | ||
value={value} | ||
onChange={handleChange} | ||
errorsByLanguage={{ | ||
en: <ErrorMessage>This is an error</ErrorMessage>, | ||
}} | ||
/> | ||
``` | ||
|
||
With the new update, you no longer need to wrap the error text so you can provide it as it is: | ||
|
||
```jsx | ||
<LocalizedTextField | ||
title="Title" | ||
value={value} | ||
onChange={handleChange} | ||
errorsByLanguage={{ | ||
en: 'This is an error', | ||
}} | ||
/> | ||
``` | ||
|
||
We still support the former, but we encourage using the new way to provide errors. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.