Skip to content

Commit

Permalink
fix storybook runtime errors (#141)
Browse files Browse the repository at this point in the history
* fix comment style on columns.util

* fix: re-add getprimarycolor and getprimaryshade utilities

* fix: storybook runtime errors
  • Loading branch information
alessandrojcm authored Sep 27, 2023
1 parent 64e3d20 commit 7142847
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
3 changes: 2 additions & 1 deletion packages/mantine-react-table/src/column.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
type BoxProps,
type CssVariable,
type CssVariables,
type MantineStyleProp,
type MantineTheme,
} from '@mantine/core';
import {
Expand Down Expand Up @@ -300,7 +301,7 @@ export const getCommonCellStyles = <TData extends Record<string, any> = {}>({
table: MRT_TableInstance<TData>;
tableCellProps: BoxProps;
theme: MantineTheme;
}): { __vars: CssVariables; className: string; style: CSSStyleDeclaration } => {
}): { __vars: CssVariables; className: string; style: MantineStyleProp } => {
const __vars: Record<CssVariable, string | undefined> = {};
const headerId = `--${header ? 'header' : 'col'}-${parseCSSVarId(
header?.id ?? column.id,
Expand Down
3 changes: 1 addition & 2 deletions packages/mantine-react-table/src/footer/MRT_TableFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const MRT_TableFooter = <TData extends Record<string, any> = {}>({
} = table;
const { isFullScreen } = getState();

const { className, ...tableFooterProps } =
const tableFooterProps =
mantineTableFooterProps instanceof Function
? mantineTableFooterProps({ table })
: mantineTableFooterProps;
Expand All @@ -41,7 +41,6 @@ export const MRT_TableFooter = <TData extends Record<string, any> = {}>({
layoutMode === 'grid'
? classes.MRT_TableFooterGrid
: classes.MRT_TableFooterTableRowGroup,
className,
)}
style={(theme) => ({
...(tableFooterProps?.style instanceof Function
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from '@mantine/core';
import { Box, useMantineTheme } from '@mantine/core';
import clsx from 'clsx';
import { getCommonCellStyles } from '../column.utils';
import { type MRT_Header, type MRT_TableInstance } from '../types';
Expand All @@ -13,6 +13,7 @@ export const MRT_TableFooterCell = <TData extends Record<string, any> = {}>({
footer,
table,
}: Props<TData>) => {
const theme = useMantineTheme();
const {
options: { layoutMode, mantineTableFooterCellProps },
} = table;
Expand Down Expand Up @@ -51,7 +52,7 @@ export const MRT_TableFooterCell = <TData extends Record<string, any> = {}>({
component="th"
align={columnDefType === 'group' ? 'center' : 'left'}
colSpan={footer.colSpan}
data-selected={row?.getIsSelected() ?? 'false'}
data-selected={'false'}
data-ispinned={column?.getIsPinned() ?? 'false'}
data-columndef={columnDefType}
{...tableCellProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const MRT_TableFooterRow = <TData extends Record<string, any> = {}>({
)
return null;

const { className, ...tableRowProps } =
const tableRowProps =
mantineTableFooterRowProps instanceof Function
? mantineTableFooterRowProps({ footerGroup, table })
: mantineTableFooterRowProps;
Expand All @@ -52,7 +52,6 @@ export const MRT_TableFooterRow = <TData extends Record<string, any> = {}>({
layoutMode === 'grid'
? classes.MRT_TableFooterRowGrid
: classes.MRT_TableFooterRowTableRow,
className,
)}
{...tableRowProps}
style={(theme) => ({
Expand Down
3 changes: 1 addition & 2 deletions packages/mantine-react-table/src/head/MRT_TableHeadCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const MRT_TableHeadCell = <TData extends Record<string, any> = {}>({
borderRight: draggingBorder,
borderTop: draggingBorder,
}
: undefined;
: {};

const handleDragEnter = (_e: DragEvent) => {
if (enableGrouping && hoveredColumn?.id === 'drop-zone') {
Expand Down Expand Up @@ -127,7 +127,6 @@ export const MRT_TableHeadCell = <TData extends Record<string, any> = {}>({
<Box
component="th"
align={columnDefType === 'group' ? 'center' : 'left'}
data-selected={row?.getIsSelected() ?? 'false'}
data-ispinned={column?.getIsPinned() ?? 'false'}
data-cansort={column.getCanSort()}
data-isresizing={column.getIsResizing()}
Expand Down
3 changes: 1 addition & 2 deletions packages/mantine-react-table/src/head/MRT_TableHeadRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const MRT_TableHeadRow = <TData extends Record<string, any> = {}>({
} = table;
const { isFullScreen } = getState();

const { className, ...tableRowProps } =
const tableRowProps =
mantineTableHeadRowProps instanceof Function
? mantineTableHeadRowProps({ headerGroup, table })
: mantineTableHeadRowProps;
Expand All @@ -44,7 +44,6 @@ export const MRT_TableHeadRow = <TData extends Record<string, any> = {}>({
className={clsx(
classes.MRT_TableHeadRow,
stickyHeader && classes.MRT_TableHeadRowSticky,
className,
)}
__vars={{
'--display': layoutMode === 'grid' ? 'flex' : 'table-row',
Expand Down

0 comments on commit 7142847

Please sign in to comment.