Skip to content

Commit

Permalink
Revert "[@mantine/core] Change how primary color fallback is applied …
Browse files Browse the repository at this point in the history
…in default `theme.variantColorResolver` to allow setting custom fallback values and `undefined` handling"

This reverts commit 5550ce2.
  • Loading branch information
rtivital committed Oct 26, 2023
1 parent 16d39ff commit 80ff94d
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/mantine-core/src/components/ActionIcon/ActionIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const defaultProps: Partial<ActionIconProps> = {};
const varsResolver = createVarsResolver<ActionIconFactory>(
(theme, { size, radius, variant, gradient, color }) => {
const colors = theme.variantColorResolver({
color,
color: color || theme.primaryColor,
theme,
gradient,
variant: variant || 'filled',
Expand Down
2 changes: 1 addition & 1 deletion src/mantine-core/src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const defaultProps: Partial<AlertProps> = {};

const varsResolver = createVarsResolver<AlertFactory>((theme, { radius, color, variant }) => {
const colors = theme.variantColorResolver({
color,
color: color || theme.primaryColor,
theme,
variant: variant || 'light',
});
Expand Down
2 changes: 1 addition & 1 deletion src/mantine-core/src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const defaultProps: Partial<BadgeProps> = {};
const varsResolver = createVarsResolver<BadgeFactory>(
(theme, { radius, color, gradient, variant, size }) => {
const colors = theme.variantColorResolver({
color,
color: color || theme.primaryColor,
theme,
gradient,
variant: variant || 'filled',
Expand Down
2 changes: 1 addition & 1 deletion src/mantine-core/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const defaultProps: Partial<ButtonProps> = {};
const varsResolver = createVarsResolver<ButtonFactory>(
(theme, { radius, color, gradient, variant, size, justify }) => {
const colors = theme.variantColorResolver({
color,
color: color || theme.primaryColor,
theme,
gradient,
variant: variant || 'filled',
Expand Down
2 changes: 1 addition & 1 deletion src/mantine-core/src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const defaultProps: Partial<ChipProps> = {

const varsResolver = createVarsResolver<ChipFactory>((theme, { size, radius, variant, color }) => {
const colors = theme.variantColorResolver({
color,
color: color || theme.primaryColor,
theme,
variant: variant!,
});
Expand Down
2 changes: 1 addition & 1 deletion src/mantine-core/src/components/NavLink/NavLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const defaultProps: Partial<NavLinkProps> = {};
const varsResolver = createVarsResolver<NavLinkFactory>(
(theme, { variant, color, childrenOffset }) => {
const colors = theme.variantColorResolver({
color,
color: color || theme.primaryColor,
theme,
variant: variant || 'light',
});
Expand Down
2 changes: 1 addition & 1 deletion src/mantine-core/src/components/ThemeIcon/ThemeIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const defaultProps: Partial<ThemeIconProps> = {};
const varsResolver = createVarsResolver<ThemeIconFactory>(
(theme, { size, radius, variant, gradient, color }) => {
const colors = theme.variantColorResolver({
color,
color: color || theme.primaryColor,
theme,
gradient,
variant: variant || 'filled',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const defaultVariantColorsResolver: VariantColorsResolver = ({
variant,
gradient,
}) => {
const parsed = parseThemeColor({ color: color || theme.primaryColor, theme });
const parsed = parseThemeColor({ color, theme });

if (variant === 'filled') {
if (parsed.isThemeColor) {
Expand Down

0 comments on commit 80ff94d

Please sign in to comment.