UNPKG

@redocly/theme

Version:

Shared UI components lib

34 lines (33 loc) 1.35 kB
import React, { ReactNode } from 'react'; import type { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config'; import type { SortOption } from '../../../core/types'; export type BaseEntity = { id: string; key: string; type: string; title: string; summary?: string | null; }; export type CatalogTableViewProps<T extends BaseEntity> = { entities: T[]; entitiesCatalogConfig?: EntitiesCatalogConfig; catalogConfig: CatalogEntityConfig; columns?: CatalogColumn<T>[]; setSortOption: (sortOption: SortOption | null) => void; currentSortOption?: SortOption | null; onRowClick?: (entity: T) => void; handleSortClick: (sortKey: string, direction: 'asc' | 'desc') => void; isColumnSorted: (sortKey: string, direction: 'asc' | 'desc') => boolean; style?: React.CSSProperties; contentMinWidth?: number; }; export type CatalogColumn<T> = { key: string; title: string; render: (entity: T) => ReactNode; width?: string; minWidth?: string; sortable?: boolean; sortKey?: string; }; export declare const CatalogTableView: <T extends BaseEntity>({ entities, entitiesCatalogConfig, catalogConfig, columns, setSortOption, currentSortOption, onRowClick, handleSortClick, isColumnSorted, style, contentMinWidth, }: CatalogTableViewProps<T>) => React.JSX.Element;