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

Fix: design system property inheritance #15106

Merged
merged 3 commits into from
Sep 17, 2020
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "minor",
"comment": "fix design system properties inheritance",
"packageName": "@fluentui/web-components",
"email": "jes@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-09-17T22:15:13.616Z"
}
10 changes: 5 additions & 5 deletions packages/web-components/src/card/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { customElement } from '@microsoft/fast-element';
import { ColorRGBA64, parseColorHexRGB } from '@microsoft/fast-colors';
import { designSystemProperty, DesignSystemProvider, CardTemplate as template } from '@microsoft/fast-foundation';
import { designSystemProperty, designSystemProvider, CardTemplate as template } from '@microsoft/fast-foundation';
import { createColorPalette, DesignSystem } from '@microsoft/fast-components-styles-msft';
import { FluentDesignSystemProvider } from '../design-system-provider';
import { CardStyles as styles } from './card.styles';

/**
Expand All @@ -13,12 +13,12 @@ import { CardStyles as styles } from './card.styles';
* @remarks
* HTML Element: \<fluent-card\>
*/
@customElement({
@designSystemProvider({
name: 'fluent-card',
template,
styles,
})
export class FluentCard extends DesignSystemProvider
export class FluentCard extends FluentDesignSystemProvider
implements Pick<DesignSystem, 'backgroundColor' | 'neutralPalette'> {
/**
* Background color for the banner component. Sets context for the design system.
Expand All @@ -31,7 +31,7 @@ export class FluentCard extends DesignSystemProvider
default: '#FFFFFF',
})
public backgroundColor: string;
private backgroundColorChanged(): void {
protected backgroundColorChanged(): void {
const parsedColor = parseColorHexRGB(this.backgroundColor);
this.neutralPalette = createColorPalette(parsedColor as ColorRGBA64);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class FluentDesignSystemProvider extends DesignSystemProvider
default: DesignSystemDefaults.backgroundColor,
})
public backgroundColor: string;
private backgroundColorChanged() {
protected backgroundColorChanged(): void {
// If background changes or is removed, we need to
// re-evaluate whether we should have paint styles applied
this.noPaintChanged();
Expand Down