UNPKG

@redocly/theme

Version:

Shared UI components lib

23 lines 911 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useCatalogTableHeaderCellActions = useCatalogTableHeaderCellActions; function useCatalogTableHeaderCellActions({ column, handleSortClick, setSortOption, isColumnSorted, }) { const sortKey = column.sortKey; const isUpActive = sortKey ? isColumnSorted(sortKey, 'desc') : false; const isDownActive = sortKey ? isColumnSorted(sortKey, 'asc') : false; const handleCellClick = () => { if (!column.sortable || !sortKey) return; if (isDownActive) { handleSortClick(sortKey, 'desc'); } else if (isUpActive) { setSortOption(null); } else { handleSortClick(sortKey, 'asc'); } }; return { handleCellClick, sortKey, isUpActive, isDownActive }; } //# sourceMappingURL=use-catalog-table-header-cell-actions.js.map