import Box, { type BoxProps } from '@mui/material/Box'; import IconButton from '@mui/material/IconButton'; import Tooltip from '@mui/material/Tooltip'; import { type MRT_Column, type MRT_RowData, type MRT_TableInstance, } from '../../types'; import { parseFromValuesOrFunc } from '../../utils/utils'; export interface MRT_ColumnPinningButtonsProps extends BoxProps { column: MRT_Column; table: MRT_TableInstance; } export const MRT_ColumnPinningButtons = ({ column, table, ...rest }: MRT_ColumnPinningButtonsProps) => { const { options: { icons: { PushPinIcon }, localization, }, } = table; const handlePinColumn = (pinDirection: 'left' | 'right' | false) => { column.pin(pinDirection); }; return ( ({ minWidth: '70px', textAlign: 'center', ...(parseFromValuesOrFunc(rest?.sx, theme) as any), })} > {column.getIsPinned() ? ( handlePinColumn(false)} size="small"> ) : ( <> handlePinColumn('left')} size="small"> handlePinColumn('right')} size="small"> )} ); };