-
Notifications
You must be signed in to change notification settings - Fork 47
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
🚀 feat: added accordion button props so we can customize type #820
base: master
Are you sure you want to change the base?
Conversation
@@ -220,9 +221,13 @@ const Accordion = ({ | |||
disabled={disabled} | |||
onClick={() => { | |||
setOpen(o => !o); | |||
if (headerProps.onClick) { |
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.
if (headerProps.onClick) { | |
if (typeof headerProps.onClick === 'function') { |
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.
Updated @MicaelRodrigues
f08119b
to
a8ac9ef
Compare
|
if (typeof headerProps.onClick === 'function') { | ||
headerProps.onClick(); | ||
} |
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.
if (typeof headerProps.onClick === 'function') { | |
headerProps.onClick(); | |
} | |
headerProps.onClick?.(); |
Description 📄
The goal of this PR is to help solve an issue related with the type of the button inside forms.
The bug we have is trigger everytime we click on the accordion header (button) that causes the form to be submitted.
Behaviour we don't want. To avoid this I added the props of the button so we can modify it's type.
Also added the onClick function in case someone in the future requires to track the event fired by the button, this can be removed since we don't need it at the moment and just thought it was a nice addition.
Platforms 📲
Type of change 🔍
How Has This Been Tested? 🧪
[Enter the tips to test this PR]
Checklist: 🔍
Screenshots 📸
Screen.Recording.2024-06-18.at.08.42.05.mov
[Upload your screenshots here]