const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_materials = require("@pisell/materials");
let _pisell_icon_es_ChevronDown = require("@pisell/icon/es/ChevronDown");
_pisell_icon_es_ChevronDown = require_runtime.__toESM(_pisell_icon_es_ChevronDown);
require("./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 = (props) => {
	const { onChange } = props;
	const [current, setCurrent] = (0, react.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.default.createElement(_pisell_materials.Dropdown, { menu: {
		items: sortItems,
		onClick
	} }, /* @__PURE__ */ react.default.createElement("span", { className: "sort-warp" }, /* @__PURE__ */ react.default.createElement("span", { className: "type" }, current), /* @__PURE__ */ react.default.createElement(_pisell_icon_es_ChevronDown.default, { className: "down-icon" })));
};
//#endregion
exports.default = Sort;
