Ory Elements is a component library that makes building login, registration and account pages for Ory a breeze. Check out the components library on Chromatic https://www.chromatic.com/library?appId=63b58e306cfd32348fa48d50
This PR adds the option to specify a link handler in order to make use of client side navigation. This is fully backward compatible, without introducing any new parameters which have to be passed around.
This is achieved by extending the type of href in the ButtonLink component to also accept a tuple of a URL and a handler. When this tuple is defined, the default click event will be prevented and the handler will be called with the URL.
In it's simplest form, this allows to easily use React's navigation feature like this:
[x] I confirm that this pull request does not address a security vulnerability.
If this pull request addresses a security vulnerability,
I confirm that I got green light (please contact security@ory.sh) from the maintainers to push the changes.
[x] I have added tests that prove my fix is effective or that my feature works.
[ ] I have added necessary documentation within the code base (if appropriate).
I have made some changes to this PR based on my review. Would you review to make sure the changes also look alright from your side? I will let @mszekiel also review the changes before merge.
Fixes #58
This PR adds the option to specify a link handler in order to make use of client side navigation. This is fully backward compatible, without introducing any new parameters which have to be passed around.
This is achieved by extending the type of
href
in theButtonLink
component to also accept a tuple of a URL and a handler. When this tuple is defined, the default click event will be prevented and the handler will be called with the URL.In it's simplest form, this allows to easily use React's navigation feature like this:
Checklist