UNPKG

@coveord/plasma-mantine

Version:

A Plasma flavoured Mantine theme

42 lines (41 loc) 1.41 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { factory } from '@mantine/core'; import { useDidUpdate } from '@mantine/hooks'; import { useState } from 'react'; import { LastUpdated } from '../../LastUpdated/LastUpdated.js'; import { useTableContext } from '../TableContext.js'; export const TableLastUpdated = factory((props, ref)=>{ const { table, getStyles } = useTableContext(); const { classNames: _classNames, styles: _styles, vars: _vars, ...lastUpdatedProps } = props; const [time, setTime] = useState(new Date()); const { className: rootClassName, style: rootStyle } = getStyles('lastUpdatedRoot', { classNames: _classNames, styles: _styles }); const { className: labelClassName, style: labelStyle } = getStyles('lastUpdatedLabel', { classNames: _classNames, styles: _styles }); useDidUpdate(()=>{ setTime(new Date()); }, [ table.options.data ]); return /*#__PURE__*/ _jsx(LastUpdated, { time: time, ref: ref, justify: "right", px: "lg", classNames: { root: rootClassName, label: labelClassName }, styles: { root: rootStyle, label: labelStyle }, ...lastUpdatedProps }); }); TableLastUpdated.displayName = 'Table.LastUpdated'; //# sourceMappingURL=TableLastUpdated.js.map