import classNames from 'classnames'; import React, { useCallback } from 'react'; import { useDispatch } from 'react-redux'; import ArtistIndexTableOptions from 'Artist/Index/Table/ArtistIndexTableOptions'; import IconButton from 'Components/Link/IconButton'; import Column from 'Components/Table/Column'; import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper'; import VirtualTableHeader from 'Components/Table/VirtualTableHeader'; import VirtualTableHeaderCell from 'Components/Table/VirtualTableHeaderCell'; import { icons } from 'Helpers/Props'; import SortDirection from 'Helpers/Props/SortDirection'; import { setArtistSort, setArtistTableOption, } from 'Store/Actions/artistIndexActions'; import hasGrowableColumns from './hasGrowableColumns'; import styles from './ArtistIndexTableHeader.css'; interface ArtistIndexTableHeaderProps { showBanners: boolean; columns: Column[]; sortKey?: string; sortDirection?: SortDirection; } function ArtistIndexTableHeader(props: ArtistIndexTableHeaderProps) { const { showBanners, columns, sortKey, sortDirection } = props; const dispatch = useDispatch(); const onSortPress = useCallback( (value) => { dispatch(setArtistSort({ sortKey: value })); }, [dispatch] ); const onTableOptionChange = useCallback( (payload) => { dispatch(setArtistTableOption(payload)); }, [dispatch] ); return ( {columns.map((column) => { const { name, label, isSortable, isVisible } = column; if (!isVisible) { return null; } if (name === 'actions') { return ( ); } return ( {typeof label === 'function' ? label() : label} ); })} ); } export default ArtistIndexTableHeader;