Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-add getprimaryshade and getprimarycolor #140

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion packages/mantine-react-table/src/columns.utils.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
--width: calc(var(--header-id) * 1px);
--bg-color: color-mix(in srgb, var(--mantine-color-dark-7) .2%, var(--mantine-color-black));
background-color: inherit;
// Not very sure about these attribute gymnastics...
/* Not very sure about these attribute gymnastics... */
[data-selected="true"] {
background-color: rgba(var(--mantine-primary-color-filled), 0.1);
}
Expand Down
Loading