-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a new React hook to access Projects Images rewrite configurati…
…on (#2639) * feat(image regexconfig hook): write hook for image regex rewrite configuration * feat(image regexconfig hook): cover more test cases * feat(image regexconfig hook): update component deprecation warning message * feat(image regexconfig hook): add tiny warning package * feat(image regexconfig hook): mock tiny warning package * feat(image regexconfig hook): update changeset with more description * feat(image regexconfig hook): format changeset snippet * feat(image regexconfig hook): update changeset formatting * feat(image regexconfig hook): update test foreach array in describe block
- Loading branch information
Showing
7 changed files
with
194 additions
and
107 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,31 @@ | ||
--- | ||
'@commercetools-frontend/application-shell-connectors': patch | ||
--- | ||
|
||
There is a new React hook which you can use to access the Project Images rewrite configuration [see documentation](https://docs.commercetools.com/custom-applications/api-reference/commercetools-frontend-application-shell-connectors#project-image-settings). | ||
|
||
You would use it like this: | ||
|
||
```js | ||
function MyComponent() { | ||
const { isLoading, imageRegex } = useProjectExtensionImageRegex(); | ||
|
||
if (isLoading) return <LoadingSpinner />; | ||
|
||
return ( | ||
<div> | ||
<h1>Project images regex: {imageRegex}</h1> | ||
</div> | ||
); | ||
} | ||
|
||
function MyApp() { | ||
return ( | ||
<ProjectExtensionProviderForImageRegex> | ||
<MyComponent /> | ||
</ProjectExtensionProviderForImageRegex> | ||
); | ||
} | ||
``` | ||
|
||
Both `GetProjectExtensionImageRegex` component and `withProjectExtensionImageRegex` still exists for backwards compatibility but have been marked as deprecated. |
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.
78de0ec
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.
Deploy preview for merchant-center-application-kit ready!
✅ Preview
https://merchant-center-application-lhrl571b3-commercetools.vercel.app
Built with commit 78de0ec.
This pull request is being automatically deployed with vercel-action