Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

feat : Button component onClick and href prop #10156

Closed
wants to merge 1 commit into from
Closed

feat : Button component onClick and href prop #10156

wants to merge 1 commit into from

Conversation

nidhish-srivastava
Copy link

@nidhish-srivastava nidhish-srivastava commented Jan 20, 2024

Fixes Issue

#10141

Changes proposed

Added onClick and href prop to the button component since they are the most used props while using the Button component so we get better intellisense while developing.

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

Screenshots

Note to reviewers

@@ -34,6 +36,8 @@ export default function Button({

const button = (
<button
href={href}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
href={href}

Shouldn't we move the href prop to Link?
It seems like the intention was to use the href prop to determine whether to render a Link or a button. However, the return statement (return restProps.href ? link : button;) will always return a link (without an href) in this case.

Maybe we should move the href prop to the Link component. This way, when href is present, the Link component will be rendered with the href attribute, and when href is not present, a button will be rendered instead.

<Link
      href={href}

Also we should change the return statement to href ? link : button;

Copy link
Author

Choose a reason for hiding this comment

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

i was thinking of the same thing as well

@ArvindParekh
Copy link
Member

Also, could you please edit your PR description and link your issue below the heading, with a hash, like this: #10141

@nidhish-srivastava nidhish-srivastava changed the title feat: added onClick and href prop in Button component feat : Button component onClick and href prop Jan 21, 2024
@SaraJaoude SaraJaoude added the issue linked Pull Request has issue linked label Jan 23, 2024
@nidhish-srivastava nidhish-srivastava closed this by deleting the head repository Jun 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue linked Pull Request has issue linked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Adding onClick prop in the Button component for better intellisense
3 participants