/* eslint-disable @typescript-eslint/no-explicit-any */
import dayjs from 'dayjs'
import { MouseEventHandler, ReactNode, forwardRef } from 'react'
import { LinkButton } from './Button'
import { ArrowSmallDownIcon } from '@heroicons/react/20/solid'
import { SortConfig } from 'hooks/useSortableData'
export const Table = ({
children,
className,
}: {
children: ReactNode
className?: string
}) =>
export const TrHead = ({
children,
className,
}: {
children: ReactNode
className?: string
}) => {children}
export const Th = ({
children,
className,
id,
xBorder = false,
}: {
children?: ReactNode
className?: string
id?: string
xBorder?: boolean
}) => (
{children}
|
)
interface TrBodyProps {
children: ReactNode
className?: string
onClick?: () => void
onMouseEnter?: (x: any) => void
onMouseLeave?: MouseEventHandler
}
export const TrBody = forwardRef(
(props, ref) => {
const { children, className, onClick, onMouseEnter, onMouseLeave } = props
return (
{children}
)
},
)
TrBody.displayName = 'TrBody'
export const Td = ({
children,
className,
xBorder = false,
}: {
children: ReactNode
className?: string
xBorder?: boolean
}) => (
{children}
|
)
export const TableDateDisplay = ({
date,
showSeconds,
}: {
date: string | number
showSeconds?: boolean
}) => (
<>
{dayjs(date).format('DD MMM YYYY')}
{dayjs(date).format(showSeconds ? 'h:mm:ssa' : 'h:mma')}
>
)
export const SortableColumnHeader = ({
sort,
sortConfig,
sortKey,
title,
titleClass,
}: {
sort: (key: string) => void
sortConfig: SortConfig | null
sortKey: string
title: string
titleClass?: string
}) => {
return (
sort(sortKey)}
>
{title}
)
}