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 custom button component for the SignInButton component #170

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

zacharytyhacz
Copy link

Motivation

The SignInButton is ready to go, but does not allow much customization.

This PR adds the ability to pass in your own button component to be the 'Sign In with Farcaster' button and still work with the other built in components and functionality.

Change Summary

Added optional prop Button?: (props: { onClick: () => void }) => JSX.Element; to the SignInButton and then will conditionally use the Button prop if given, or default fallback to the <ActionButton ...

Customizing the SignInButton button component

import { SignInButton } from "@farcaster/auth-kit";

export const SignIn = ({ nonce }: { nonce: string }) => {
  return (
    <SignInButton
      nonce={nonce}
      onSuccess={({ fid, username }) =>
        console.log(`Hello, ${username}! Your fid is ${fid}.`)
      }

      Button={({ onClick }) => (
        <button onClick={onClick}>
            My custom sign in with farcaster button.
            Only prop to ensure is onClick
        </button>
      )}
    />
  );
};

Merge Checklist

Choose all relevant options below by adding an x now or at any time before submitting for review

  • PR title adheres to the conventional commits standard
  • PR has a changeset
  • PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore)
  • PR includes documentation if necessary
  • All commits have been signed

Additional Context

N/A

@zacharytyhacz zacharytyhacz changed the title Added custom button component for the SignInButton component feat: Added custom button component for the SignInButton component May 21, 2024
@horsefacts
Copy link
Collaborator

Thanks for this, will take a look!

@zacharytyhacz
Copy link
Author

Bump

@valentinludu
Copy link

Any news with this one? The ability to customise the button it's a must have in my opinion. It takes some time to customise a button with useSignIn hook so this PR would simplify the process.

@zacharytyhacz
Copy link
Author

Bump

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

Successfully merging this pull request may close these issues.

3 participants