import {Box} from '@mantine/core'; import {useMediaQuery} from '@mantine/hooks'; import {MRT_TablePagination} from './MRT_TablePagination'; import {MRT_ToolbarAlertBanner} from './MRT_ToolbarAlertBanner'; import {MRT_ProgressBar} from './MRT_ProgressBar'; import {commonToolbarStyles} from './MRT_TopToolbar'; import {MRT_ToolbarDropZone} from './MRT_ToolbarDropZone'; import {type MRT_TableInstance} from '../types'; interface Props = {}> { table: MRT_TableInstance; } export const MRT_BottomToolbar = = {}>({table,}: Props) => { const { getState, options: { enablePagination, mantineBottomToolbarProps, positionPagination, positionToolbarAlertBanner, positionToolbarDropZone, renderBottomToolbarCustomActions, }, refs: {bottomToolbarRef}, } = table; const {isFullScreen} = getState(); const isMobile = useMediaQuery('(max-width: 720px)'); const toolbarProps = mantineBottomToolbarProps instanceof Function ? mantineBottomToolbarProps({table}) : mantineBottomToolbarProps; const stackAlertBanner = isMobile || !!renderBottomToolbarCustomActions; return ( { if (node) { bottomToolbarRef.current = node; if (toolbarProps?.ref) { toolbarProps.ref.current = node; } } }} sx={(theme) => ({ ...commonToolbarStyles({theme}), bottom: isFullScreen ? '0' : undefined, borderTop: theme.fn.lighten(theme.black, 0.1), left: 0, position: isFullScreen ? 'fixed' : 'relative', alignItems: 'center', right: 0, ...(toolbarProps?.sx instanceof Function ? toolbarProps.sx(theme) : (toolbarProps?.sx as any)), minHeight: "2.25rem", })} > {positionToolbarAlertBanner === 'bottom' && ( )} {['both', 'bottom'].includes(positionToolbarDropZone ?? '') && ( )} {renderBottomToolbarCustomActions ? ( renderBottomToolbarCustomActions({table}) ) : ( )} {enablePagination && ['bottom', 'both'].includes(positionPagination ?? '') && ( )} ); };