import React, { useState } from "react";
import { Dropdown } from "@pisell/materials";
import ChevronDown from "@pisell/icon/es/ChevronDown";
import "./index.less";
//#region src/components/workSpaceList/components/Sort/index.tsx
const sortItems = [{
	key: "1",
	label: "Created time",
	children: [{
		key: "created_at:desc",
		label: "Oldest to newest"
	}, {
		key: "created_at:asc",
		label: "Newest to oldest"
	}]
}];
const Sort$1 = (props) => {
	const { onChange } = props;
	const [current, setCurrent] = useState("Created time");
	const onClick = (detail) => {
		const clickItem = sortItems.find((item) => (item === null || item === void 0 ? void 0 : item.key) === detail.keyPath.at(-1));
		setCurrent(clickItem === null || clickItem === void 0 ? void 0 : clickItem.label);
		onChange === null || onChange === void 0 || onChange(detail.keyPath);
	};
	return /* @__PURE__ */ React.createElement(Dropdown, { menu: {
		items: sortItems,
		onClick
	} }, /* @__PURE__ */ React.createElement("span", { className: "sort-warp" }, /* @__PURE__ */ React.createElement("span", { className: "type" }, current), /* @__PURE__ */ React.createElement(ChevronDown, { className: "down-icon" })));
};
//#endregion
export { Sort$1 as default };
