"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "TokenCell", {
    enumerable: true,
    get: function() {
        return TokenCell;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _icon = require("../../../icon");
const _spinner = require("../../../spinner");
const _text = require("../../../text");
const _useGetBalance = require("./useGetBalance");
const TokenCell = (props)=>{
    const { token } = props;
    const { balance, loading } = (0, _useGetBalance.useGetBalance)(token, props.fetchBalance);
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
        className: "orderly-token-select-list-item orderly-flex orderly-cursor-pointer hover:orderly-bg-base-800",
        onClick: ()=>{
            props.onItemClick(token);
        },
        children: [
            /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex-1 orderly-flex orderly-space-x-2 orderly-items-center",
                children: [
                    /*#__PURE__*/ (0, _jsxruntime.jsx)(_icon.NetworkImage, {
                        type: "token",
                        name: token.symbol,
                        rounded: true
                    }),
                    /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                        className: "orderly-token-select-list-item-left orderly-flex orderly-flex-col",
                        children: [
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                children: token.symbol
                            }),
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                className: "orderly-text-4xs orderly-text-base-contrast/50",
                                children: token.symbol
                            })
                        ]
                    })
                ]
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                className: "orderly-token-select-list-item-right orderly-flex-1 orderly-flex orderly-items-center",
                children: loading ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_spinner.Spinner, {
                    size: "small"
                }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_text.Numeral, {
                    precision: token.precision || 2,
                    padding: false,
                    children: balance
                })
            })
        ]
    });
};

//# sourceMappingURL=tokenCell.js.map