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

Options to extend modals with custom components #14

Open
RolginRoman opened this issue Apr 30, 2024 · 0 comments
Open

Options to extend modals with custom components #14

RolginRoman opened this issue Apr 30, 2024 · 0 comments

Comments

@RolginRoman
Copy link

hey, guys. It is an ultimately useful library 👍

Requirement

Is it possible to customise the current modals' view? WalletsModal in particular.

I've seen that theming is on the roadmap, so that might be extremely handy.

Proposal

Add an additional option to UnifiedWalletContext.Provider, eg. modalInstance: FC<> and pass it if necessary.
UnifiedWalletContext.Provider could render an injected instance or fallback to the default implementation.

Current implementation extended with this proposal.

  const ConfigModal = config.modalInstance;

  return (
    <UnifiedWalletContext.Provider
      value={{
        walletPrecedence: config.walletPrecedence || [],
        handleConnectClick,
        showModal,
        setShowModal,
        walletlistExplanation: config.walletlistExplanation,
        theme: config.theme || 'light',
        walletAttachments: config.walletAttachments || {},
      }}
    >
      {ConfigModal ? (
        <ConfigModal open={showModal} onClose={() => setShowModal(false)}></ConfigModal>
      ) : (
        <ModalDialog open={showModal} onClose={() => setShowModal(false)}>
          <UnifiedWalletModal onClose={() => setShowModal(false)} />
        </ModalDialog>
      )}

      {children}
    </UnifiedWalletContext.Provider>
  );

Other things that might be made public for re-using

<UnifiedWalletContext.Provider ...>
  <PreviouslyUsedWallets value={wallets}>
     <Modal />
  </PreviouslyUsedWallets>
</UnifiedWalletContext.Provider>
const list: { highlightedBy: HIGHLIGHTED_BY; highlight: Adapter[]; others: Adapter[] }

WDYT?

What do you think about this? Would you accept such a change if our team implemented it?
I want to contribute to this package instead of locking it in a fork 🫡
Any thoughts, concerns or additional details are super welcome. Hope to hear from you soon 🙏

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

No branches or pull requests

1 participant