Skip to content

Commit

Permalink
re-add getprimaryshade and getprimarycolor (#140)
Browse files Browse the repository at this point in the history
* fix comment style on columns.util

* fix: re-add getprimarycolor and getprimaryshade utilities
  • Loading branch information
alessandrojcm authored Sep 27, 2023
1 parent 8b308b2 commit 64e3d20
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/mantine-react-table/src/column.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
type MantineTheme,
} from '@mantine/core';
import {
type MantineShade,
type MRT_Column,
type MRT_ColumnDef,
type MRT_ColumnOrderState,
Expand Down Expand Up @@ -390,6 +391,17 @@ export const MRT_DefaultDisplayColumn = {

export const parseCSSVarId = (id: string) => id.replace(/[^a-zA-Z0-9]/g, '_');

export const getPrimaryShade = (theme: MantineTheme): number =>
(theme.colorScheme === 'dark'
? // @ts-ignore
theme.primaryShade?.dark ?? theme.primaryShade
: // @ts-ignore
theme.primaryShade?.light ?? theme.primaryShade) ?? 7;

export const getPrimaryColor = (
theme: MantineTheme,
shade?: MantineShade,
): string => theme.colors[theme.primaryColor][shade ?? getPrimaryShade(theme)];
export const flexRender = _flexRender as (
Comp: Renderable<any>,
props: any,
Expand Down

0 comments on commit 64e3d20

Please sign in to comment.