/* * Copyright (c) 2022 @automata-network/wallet-sdk authors and contributors. * This software may be modified and distributed under the terms of UNLICENSED * license. Refer to the LICENSE file for details. */ import React from 'react' import { useWallet } from '../../store/wallet' import { Modal } from '../Modal/Modal' export interface ConnectorItem { label: string icon: string enabled: boolean link?: string } interface ConnectorProps { loading: boolean error?: Error items: ConnectorItem[] onSelect: (index: number) => void onClose: () => void } export const Connector: React.FC = (props) => { const { loading, error, items, onSelect, onClose } = props const { prefixCls } = useWallet() return ( {loading ? (
) : error ? (
) : items.length ? (
{items.map((item, index) => { const { enabled, icon, label, link } = item return (
{ if (enabled) { onSelect(index) } }} > {`${label}
{label}
{!enabled ? ( Install ) : null}
) })}
) : (
You don't have any wallets
)}
) }