Skip to content

Commit

Permalink
fix: gets feature branch back to a working state (#3153)
Browse files Browse the repository at this point in the history
* intial setup

* more work

* fremoved import

* refactored repeat

* updated refrences after rebase, fixed styles

* revert fast component chnage
  • Loading branch information
eljefe223 authored and radium-v committed May 18, 2020
1 parent afedd59 commit 939fac5
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 68 deletions.
6 changes: 5 additions & 1 deletion sites/fast-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"license": "MIT",
"devDependencies": {
"@microsoft/fast-components": "^0.10.1",
"@microsoft/fast-element": "^0.8.1",
"babel-core": "^6.26.3",
"babel-loader": "^8.1.0",
"babel-preset-env": "^1.7.0",
Expand All @@ -23,6 +22,11 @@
"webpack-dev-server": "^3.10.3",
"webpack-merge": "^4.2.2"
},
"dependencies": {
"@microsoft/fast-element": "^0.8.1",
"@microsoft/fast-foundation": "^0.0.1",
"@microsoft/fast-web-utilities": "^4.4.5"
},
"scripts": {
"start": "webpack-dev-server --config=./webpack.dev.js --history-api-fallback --progress",
"build": "webpack --config=./webpack.prod.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from "@microsoft/fast-element";
import { display } from "@microsoft/fast-components";
import { display } from "@microsoft/fast-foundation";

export const CardSectionStyles = css`
:host {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { css } from "@microsoft/fast-element";
import {
display,
heightNumber,
neutralFillInputHoverBehavior,
neutralFillInputRestBehavior,
neutralOutlineHoverBehavior,
neutralOutlineRestBehavior,
} from "@microsoft/fast-components";
import { heightNumber } from "@microsoft/fast-components/dist/styles/size";
import { SystemColors } from "@microsoft/fast-web-utilities";
import {
display,
forcedColorsStylesheetBehavior,
SystemColors,
focusVisible,
disabledCursor,
} from "@microsoft/fast-components";
} from "@microsoft/fast-foundation";
import { neutralForegroundRestBehavior } from "@microsoft/fast-components";

export const ColorSwatchStyles = css`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from "@microsoft/fast-element";
import { display } from "@microsoft/fast-components";
import { display } from "@microsoft/fast-foundation";

export const ContentPlacementContainerStyles = css`
${display("block")}:host {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from "@microsoft/fast-element";
import { display } from "@microsoft/fast-components";
import { display } from "@microsoft/fast-foundation";

export const ContentPlacementStyles = css`
${display("block")} :host {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css } from "@microsoft/fast-element";
import { display } from "@microsoft/fast-components";
import { display } from "@microsoft/fast-foundation";
import {
accentFillRestBehavior,
accentForegroundCutRestBehavior,
Expand All @@ -21,7 +21,7 @@ export const FastFrameStyles = css`
.wrapper {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-columns: 500px 1fr;
height: 500px;
}
Expand All @@ -35,11 +35,15 @@ export const FastFrameStyles = css`
.preview {
display: grid;
grid-gap: 40px;
grid-template-columns: 1fr 1fr;
grid-template-columns: 280px 1fr;
padding: 40px;
background: var(--background-color);
}
fast-card {
width: auto;
}
.image-container {
/** Temp background */
background: #c8c8c8;
Expand Down Expand Up @@ -84,8 +88,7 @@ export const FastFrameStyles = css`
}
.control-container-column {
display: flex;
flex-flow: row wrap;
display: grid;
}
.control-container-grid {
Expand Down Expand Up @@ -141,10 +144,6 @@ export const FastFrameStyles = css`
fast-slider {
min-width: unset;
}
fast-button {
display: contents;
}
`.withBehaviors(
accentFillRestBehavior,
accentForegroundCutRestBehavior,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { html, repeat } from "@microsoft/fast-element";
import { FastFrame } from "./fast-frame";
import { StandardLuminance } from "@microsoft/fast-components-styles-msft";
import { accentPalette } from "@microsoft/fast-components/dist/fast-design-system";
import { FASTRadio } from "@microsoft/fast-components";

export const FastFrameTemplate = html<FastFrame>`
<template>
Expand Down Expand Up @@ -80,28 +82,41 @@ export const FastFrameTemplate = html<FastFrame>`
Ultrices nibh nunc vestibulum fames. At lacus nunc lacus eget
neque.
</p>
<fast-radio-group name="background color" @change="${(x, c) =>
x.backgroundChangeHandler(c.event as MouseEvent)}>
<fast-radio-group
value="${x => x.previewBackgroundPalette[0]}"
name="background color"
@change="${(x, c) =>
x.backgroundChangeHandler(c.event as MouseEvent)}"
>
<label slot="label">Background color</label>
${repeat(
x => x.backgroundPalette,
x => x.previewBackgroundPalette,
html<string>`
<site-color-swatch
value="${x => x}"
background-color="${x => x}"
checked="${(x, c) =>
x === c.parent.previewBackgroundPalette[0]}"
></site-color-swatch>
`
)}
</fast-radio-group>
<fast-radio-group name="accent color" @change="${(x, c) =>
x.accentChangeHandler(c.event as MouseEvent)}>
<fast-radio-group
value="${x => x.previewAccentPalette[0]}"
name="accent color"
@change="${(x, c) =>
x.accentChangeHandler(c.event as MouseEvent)}"
>
<label slot="label">Accent color</label>
${repeat(
x => x.accentPalette,
(x, c) => x.previewAccentPalette,
html<string>`
<site-color-swatch
value="${x => x}"
background-color="${x => x}"
checked="${(x, c) =>
x === c.parent.previewAccentPalette[0]}"
></site-color-swatch>
`
)}
Expand All @@ -115,15 +130,15 @@ export const FastFrameTemplate = html<FastFrame>`
Tab four content. This is for testing.
</fast-tab-panel>
</fast-tabs>
<website-design-system-provider
use-defaults
<fast-design-system-provider
class="preview"
base-layer-luminance="${x =>
x.darkMode
? StandardLuminance.DarkMode
: StandardLuminance.LightMode}"
background-color="${x => x.backgroundColor}"
accent-base-color="${x => x.accentColor}"
:accentPalette=${x => x.accentPalette}
>
<fast-card>
<div class="image-container">
Expand Down Expand Up @@ -237,7 +252,7 @@ export const FastFrameTemplate = html<FastFrame>`
</fast-button>
</div>
</div>
</website-design-system-provider>
</fast-design-system-provider>
</div>
</template>
`;
26 changes: 16 additions & 10 deletions sites/fast-website/src/app/components/fast-frame/fast-frame.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FASTElement, attr, observable } from "@microsoft/fast-element";
import { FASTRadio } from "@microsoft/fast-components";
import { SiteColorSwatch } from "../color-swatch";
import { createColorPalette } from "@microsoft/fast-components";
import { parseColor, ColorRGBA64 } from "@microsoft/fast-colors";

export class FastFrame extends FASTElement {
@attr({ attribute: "accent-color" })
Expand All @@ -13,7 +13,7 @@ export class FastFrame extends FASTElement {
public darkMode: boolean = true;

@observable
public backgroundPalette: string[] = [
public previewBackgroundPalette: string[] = [
"#1F1F1F",
"#2B2B2B",
"#333333",
Expand All @@ -22,30 +22,36 @@ export class FastFrame extends FASTElement {
];

@observable
public accentPalette: string[] = [
public previewAccentPalette: string[] = [
"#F33378",
"#F34733",
"#10A7B5",
"#109B82",
"#E1A054",
];

private darkPallette: string[] = this.backgroundPalette;
private darkPallette: string[] = this.previewBackgroundPalette;

private lastSelectedIndex: number = 0;
@observable
public lastSelectedIndex: number = 0;

@observable
public accentPalette: string[];

public accentChangeHandler = (e: any): void => {
const element: HTMLInputElement = e.target;
if (element.checked) {
this.accentColor = e.target.value;
const parsedColor = parseColor(this.accentColor);
this.accentPalette = createColorPalette(parsedColor as ColorRGBA64);
}
};

public backgroundChangeHandler = (e: any): void => {
const element: HTMLInputElement = e.target;
if (element.checked) {
this.backgroundColor = e.target.value;
this.lastSelectedIndex = Array.from(this.backgroundPalette).indexOf(
this.lastSelectedIndex = Array.from(this.previewBackgroundPalette).indexOf(
e.target.value
);
}
Expand All @@ -54,16 +60,16 @@ export class FastFrame extends FASTElement {
public themeChange = (e: any): void => {
this.darkMode = !this.darkMode;
if (!this.darkMode) {
this.backgroundPalette = [
this.previewBackgroundPalette = [
"#FFFFFF",
"#F0F0F0",
"#DEDEDE",
"#D6D6D6",
"#C4C4C4",
];
} else {
this.backgroundPalette = this.darkPallette;
this.previewBackgroundPalette = this.darkPallette;
}
this.backgroundColor = this.backgroundPalette[this.lastSelectedIndex];
this.backgroundColor = this.previewBackgroundPalette[this.lastSelectedIndex];
};
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { css } from "@microsoft/fast-element";
import { display, neutralForegroundRestBehavior } from "@microsoft/fast-components";
import { neutralForegroundRestBehavior } from "@microsoft/fast-components";
import { display } from "@microsoft/fast-foundation";

export const FeatureCardStyles = css`
${display("grid")} :host {
Expand Down
1 change: 0 additions & 1 deletion sites/fast-website/src/app/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { WebsiteDesignSystemProvider } from "./design-system-provider";
export { SiteColorSwatch } from "./color-swatch";
export { SiteSectionHeader } from "./section-header";
export { FastFrame } from "./fast-frame";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { css } from "@microsoft/fast-element";
import { display, neutralForegroundRestBehavior } from "@microsoft/fast-components";
import { neutralForegroundRestBehavior } from "@microsoft/fast-components";
import { display } from "@microsoft/fast-foundation";

export const NavigationStyles = css`
${display("flex")} :host {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { html } from "@microsoft/fast-element";
import { endTemplate, startTemplate } from "@microsoft/fast-components";
import { endTemplate, startTemplate } from "@microsoft/fast-foundation";
import { Navigation } from "./navigation";

export const NavigationTemplate = html<Navigation>`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FASTElement } from "@microsoft/fast-element";
import { applyMixins, StartEnd } from "@microsoft/fast-components";
import { applyMixins, StartEnd } from "@microsoft/fast-foundation";

export class Navigation extends FASTElement {}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { display, neutralForegroundRestBehavior } from "@microsoft/fast-components";
import { neutralForegroundRestBehavior } from "@microsoft/fast-components";
import { display } from "@microsoft/fast-foundation";
import { css } from "@microsoft/fast-element";

export const SectionHeaderStyles = css`
Expand Down
4 changes: 2 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,7 @@
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<website-design-system-provider id="body-provider" class="body-provider"
<fast-design-system-provider id="body-provider" class="body-provider"
use-defaults
background-color="#1F1F1F"
accent-base-color="#F33378"
Expand Down Expand Up @@ -179,6 +179,6 @@ <h4>Other</h4>
</div>
<!-- footer:end -->
</div>
</website-design-system-provider>
</fast-design-system-provider>
</body>
</html>

0 comments on commit 939fac5

Please sign in to comment.