Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/variants",
"comment": "fix theme output from variants",
"type": "patch"
}
],
"packageName": "@uifabric/variants",
"email": "[email protected]"
}
24 changes: 21 additions & 3 deletions packages/variants/src/variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ export function getNeutralVariant(theme: IPartialTheme): ITheme {
bodyBackground: p.neutralLighter
};

return createTheme({ ...theme, ...{ palette: partialPalette, semanticColors: partialSemantic } });
return createTheme({
...theme,
...{
palette: { ...theme.palette, ...partialPalette },
semanticColors: { ...theme.semanticColors, ...partialSemantic }
}
});
}

/* Variants
Expand Down Expand Up @@ -121,7 +127,13 @@ export function getSoftVariant(theme: IPartialTheme): ITheme {
// inputFocusBorderAlt: p.themePrimary,
};

return createTheme({ ...theme, ...{ palette: partialPalette, semanticColors: partialSemantic } });
return createTheme({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems we have the same code multiple times.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY?

...theme,
...{
palette: { ...theme.palette, ...partialPalette },
semanticColors: { ...theme.semanticColors, ...partialSemantic }
}
});
}

/**
Expand Down Expand Up @@ -186,5 +198,11 @@ export function getStrongVariant(theme: IPartialTheme): ITheme {
// inputFocusBorderAlt: p.themePrimary,
};

return createTheme({ ...theme, ...{ palette: partialPalette, semanticColors: partialSemantic } });
return createTheme({
...theme,
...{
palette: { ...theme.palette, ...partialPalette },
semanticColors: { ...theme.semanticColors, ...partialSemantic }
}
});
}