import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useEffect, useState } from "react";
import { SortItem } from "../sections/sortItem";
import { useSort } from "../useSort";
import { cn } from "../../../utils";
import { OrderlyIcon } from "../../../icon";
import { Tooltip } from "../../../tooltip";
export const SortGroup = (props)=>{
    //   const onClick = (value: SortKey) => {
    //     console.log(value);
    //   };
    const [open, setOpen] = useState(false);
    const { sortKey, onSort, direction, value: currentValue } = useSort(props.value, props.readLastSortCondition);
    useEffect(()=>{
        props.onChange?.({
            key: sortKey,
            direction
        });
    }, [
        sortKey,
        direction
    ]);
    return /*#__PURE__*/ _jsxs("div", {
        className: cn("orderly-grid orderly-grid-cols-5 orderly-text-3xs orderly-text-base-contrast-54 orderly-py-3 orderly-px-5 orderly-mt-2", props.hasSuffix && "orderly-grid-cols-6"),
        children: [
            /*#__PURE__*/ _jsx("div", {
                className: "orderly-col-span-2",
                children: "Instrument"
            }),
            /*#__PURE__*/ _jsx("div", {
                className: "orderly-col-span-1 orderly-flex orderly-justify-end",
                children: /*#__PURE__*/ _jsx(SortItem, {
                    label: "Last",
                    value: "price",
                    onClick: onSort,
                    currentValue: currentValue
                })
            }),
            /*#__PURE__*/ _jsx("div", {
                className: "orderly-col-span-1 orderly-flex orderly-justify-end",
                children: /*#__PURE__*/ _jsx(SortItem, {
                    label: "24h%",
                    value: "change",
                    onClick: onSort,
                    currentValue: currentValue
                })
            }),
            /*#__PURE__*/ _jsxs("div", {
                className: "orderly-col-span-1 orderly-flex orderly-pl-2",
                children: [
                    /*#__PURE__*/ _jsx("div", {
                        className: "orderly-flex-1"
                    }),
                    /*#__PURE__*/ _jsx(Tooltip, {
                        content: "24 hour total trading volume on the Orderly Network.",
                        children: /*#__PURE__*/ _jsxs("div", {
                            className: "orderly-flex orderly-justify-end orderly-items-center",
                            children: [
                                /*#__PURE__*/ _jsx(OrderlyIcon, {
                                    size: 14,
                                    className: "orderly-mr-[6px]"
                                }),
                                /*#__PURE__*/ _jsx(SortItem, {
                                    label: "Volume",
                                    value: "vol",
                                    onClick: onSort,
                                    currentValue: currentValue
                                })
                            ]
                        })
                    })
                ]
            })
        ]
    });
};

//# sourceMappingURL=sortGroup.js.map