Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tiagogomes772
Copy link
Contributor

@tiagogomes772 tiagogomes772 commented May 24, 2024

Description 📄

  • Added header props to accordion

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 📲

  • Web
  • Mobile

Type of change 🔍

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested? 🧪

[Enter the tips to test this PR]

  • Unit Test
  • Snapshot Test

Checklist: 🔍

  • My code follows the contribution guide of this project Contributing Guide
  • Layout matches design prototype: FIGMA
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Screenshots 📸

Screen.Recording.2024-06-18.at.08.42.05.mov

[Upload your screenshots here]

Before After

@@ -220,9 +221,13 @@ const Accordion = ({
disabled={disabled}
onClick={() => {
setOpen(o => !o);
if (headerProps.onClick) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (headerProps.onClick) {
if (typeof headerProps.onClick === 'function') {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tiagogomes772 tiagogomes772 force-pushed the fix/add-accordion-button-props branch from f08119b to a8ac9ef Compare June 18, 2024 07:51
Copy link

sonarcloud bot commented Jun 18, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants