Skip to content

Commit

Permalink
Add design system providers
Browse files Browse the repository at this point in the history
  • Loading branch information
radium-v committed May 11, 2020
1 parent 10f941f commit fda4c8d
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { WebsiteDesignSystemProvider } from "./website-design-system-provider";
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ColorRGBA64, parseColor } from "@microsoft/fast-colors";
import {
designSystemProperty,
designSystemProvider,
FASTDesignSystemProvider,
} from "@microsoft/fast-components";
import { createColorPalette } from "@microsoft/fast-components-styles-msft";
import { observable } from "@microsoft/fast-element";

@designSystemProvider("website-design-system-provider")
export class WebsiteDesignSystemProvider extends FASTDesignSystemProvider {
@observable
@designSystemProperty({
cssCustomProperty: false,
default: createColorPalette(parseColor("#F33378") as ColorRGBA64),
})
public accentPalette: string[];

accentBaseColorChanged(): void {
const parsedColor = parseColor(this.accentBaseColor);
this.accentPalette = createColorPalette(parsedColor as ColorRGBA64);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const FastFrameStyles = css`
.preview {
display: flex;
background: #c8c8c8;
background: var(--background-color);
align-items: center;
justify-content: center;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ export const FastFrameTemplate = html<FastFrame>`
Tab four content. This is for testing.
</fast-tab-panel>
</fast-tabs>
<div class="preview">
<website-design-system-provider class="preview" background-color="#424242">
Preview goes here
</div>
</website-design-system-provider>
</div>
</template>
`;
10 changes: 0 additions & 10 deletions sites/fast-website/src/app/components/gradient-picker/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion sites/fast-website/src/app/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { GradientPicker } from "./gradient-picker";
export { WebsiteDesignSystemProvider } from "./design-system-provider";
export { FASTSectionHeader } from "./section-header";
export { FastFrame } from "./fast-frame";
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { accentFillRestBehavior, display } from "@microsoft/fast-components";
import { css } from "@microsoft/fast-element";
import { display } from "@microsoft/fast-components";

export const SectionHeaderStyles = css`
${display("flex")} :host {
Expand All @@ -9,4 +9,8 @@ export const SectionHeaderStyles = css`
box-sizing: border-box;
text-align: center;
}
:host ::slotted(.section-badge) {
color: var(--accent-fill-rest);
}
`;
10 changes: 9 additions & 1 deletion sites/fast-website/src/app/css/style.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
:root {
/* FIXME: Is there a better way to set default props to prevent FOUC? */
--background-color: #242424;
}

body {
background-color: var(--background-color);
color: var(--neutral-foreground-rest);
margin: 0;
padding: 0;
}

.body-provider {
background-color: var(--background-color);
}

.wrapper {
display: grid;
grid-template-columns: minmax(5vw, 1fr) minmax(0px, 1600px) minmax(5vw, 1fr);
Expand Down Expand Up @@ -53,7 +62,6 @@ body {
}

.section-badge {
/* color: var(--accent-foreground-rest); */
font-weight: bold;
}

Expand Down
8 changes: 6 additions & 2 deletions sites/fast-website/src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<fast-design-system-provider use-defaults>
<website-design-system-provider id="body-provider" class="body-provider"
use-defaults
background-color="#242424"
accent-base-color="#F33378"
>
<div class="wrapper">
<!-- header:start -->
<header class="header">
Expand Down Expand Up @@ -123,6 +127,6 @@
</footer>
<!-- footer:end -->
</div>
</fast-design-system-provider>
</website-design-system-provider>
</body>
</html>

0 comments on commit fda4c8d

Please sign in to comment.