UNPKG

@skbkontur/db-viewer-ui

Version:

Database Viewer with custom configuration

18 lines 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CountOfRecordsSelector = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const ArrowCDownIcon16Regular_1 = require("@skbkontur/icons/icons/ArrowCDownIcon/ArrowCDownIcon16Regular"); const CounterIcon16Regular_1 = require("@skbkontur/icons/icons/CounterIcon/CounterIcon16Regular"); const react_ui_1 = require("@skbkontur/react-ui"); const CountOfRecordsSelector = ({ count: currentCount, onChange, }) => { const renderLinkDropdownItem = (count) => { if (count === currentCount) { return null; } return ((0, jsx_runtime_1.jsx)(react_ui_1.MenuItem, { onClick: () => onChange(count), "data-tid": `${count}Items`, children: count }, `${count}Items`)); }; return ((0, jsx_runtime_1.jsx)(react_ui_1.DropdownMenu, { "data-tid": "CountDropdown", menuWidth: 200, caption: (0, jsx_runtime_1.jsxs)(react_ui_1.Link, { "data-tid": "CurrentCount", rightIcon: (0, jsx_runtime_1.jsx)(ArrowCDownIcon16Regular_1.ArrowCDownIcon16Regular, { align: "baseline" }), icon: (0, jsx_runtime_1.jsx)(CounterIcon16Regular_1.CounterIcon16Regular, { align: "baseline" }), children: [currentCount, " \u0437\u0430\u043F\u0438\u0441\u0435\u0439 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435"] }), children: [20, 50, 100].map(renderLinkDropdownItem) })); }; exports.CountOfRecordsSelector = CountOfRecordsSelector; //# sourceMappingURL=CountOfRecordsSelector.js.map