import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { NetworkImage } from "../../../icon";
import { Spinner } from "../../../spinner";
import { Numeral } from "../../../text";
import { useGetBalance } from "./useGetBalance";
export const TokenCell = (props)=>{
    const { token } = props;
    const { balance, loading } = useGetBalance(token, props.fetchBalance);
    return /*#__PURE__*/ _jsxs("div", {
        className: "orderly-token-select-list-item orderly-flex orderly-cursor-pointer hover:orderly-bg-base-800",
        onClick: ()=>{
            props.onItemClick(token);
        },
        children: [
            /*#__PURE__*/ _jsxs("div", {
                className: "orderly-flex-1 orderly-flex orderly-space-x-2 orderly-items-center",
                children: [
                    /*#__PURE__*/ _jsx(NetworkImage, {
                        type: "token",
                        name: token.symbol,
                        rounded: true
                    }),
                    /*#__PURE__*/ _jsxs("div", {
                        className: "orderly-token-select-list-item-left orderly-flex orderly-flex-col",
                        children: [
                            /*#__PURE__*/ _jsx("span", {
                                children: token.symbol
                            }),
                            /*#__PURE__*/ _jsx("span", {
                                className: "orderly-text-4xs orderly-text-base-contrast/50",
                                children: token.symbol
                            })
                        ]
                    })
                ]
            }),
            /*#__PURE__*/ _jsx("div", {
                className: "orderly-token-select-list-item-right orderly-flex-1 orderly-flex orderly-items-center",
                children: loading ? /*#__PURE__*/ _jsx(Spinner, {
                    size: "small"
                }) : /*#__PURE__*/ _jsx(Numeral, {
                    precision: 2,
                    padding: false,
                    children: balance
                })
            })
        ]
    });
};

//# sourceMappingURL=tokenCell.js.map