Skip to content

Commit

Permalink
feat: adds density slider to marketing site (#3166)
Browse files Browse the repository at this point in the history
* feat: adds density slider to marketing site

* ran prettier
  • Loading branch information
eljefe223 authored and chrisdholt committed Jun 4, 2020
1 parent 33b838e commit 7bd69b7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const FastFrameStyles = css`
.wrapper {
display: grid;
grid-template-columns: 500px 1fr;
height: 500px;
min-height: 500px;
}
.content {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ export const FastFrameTemplate = html<FastFrame>`
<template>
<div class="wrapper">
<fast-tabs orientation="vertical" id="myTab" activeId="TabTwo">
<fast-tab id="TabOne" title="Mode">${ContrastIcon}</fast-tab>
<fast-tab id="TabTwo" title="Color">${PaletteIcon}</fast-tab>
<fast-tab id="TabThree" title="Styles">${SwatchesIcon}</fast-tab>
<fast-tab id="TabFour" title="Density">${ScreenIcon}</fast-tab>
<fast-tab-panel id="TabPanelOne">
<fast-tab id="contrast-tab" title="Mode">${ContrastIcon}</fast-tab>
<fast-tab id="palette-tab" title="Color">${PaletteIcon}</fast-tab>
<fast-tab id="swatches-tab" title="Styles">${SwatchesIcon}</fast-tab>
<fast-tab id="density-tab" title="Density">${ScreenIcon}</fast-tab>
<fast-tab-panel id="contrast-tab-panel">
<fast-switch
checked="${x => x.darkMode}"
@change="${(x, c) => x.themeChange(c.event as MouseEvent)}"
>
Dark Mode
</fast-switch>
</fast-tab-panel>
<fast-tab-panel id="TabPanelTwo">
<fast-tab-panel id="palette-tab-panel">
<div class="content">
<h1>FAST FRAME COLORS</h1>
<h2>Pre-existing color you can customize.</h2>
Expand Down Expand Up @@ -75,11 +75,23 @@ export const FastFrameTemplate = html<FastFrame>`
</fast-radio-group>
</div>
</fast-tab-panel>
<fast-tab-panel id="TabPanelThree">
<fast-tab-panel id="swatches-tab-panel">
Tab three content. This is for testing.
</fast-tab-panel>
<fast-tab-panel id="TabPanelFour">
Tab four content. This is for testing.
<fast-tab-panel id="density-tab-panel">
<div class="content">
<label for="density-slider">Density</label>
<fast-slider
id="density-slider"
min="0"
max="3"
step="1"
value="0"
@change="${(x, c) =>
x.densityChangeHandler(c.event as MouseEvent)}"
>
</fast-slider>
</div>
</fast-tab-panel>
</fast-tabs>
<fast-design-system-provider
Expand All @@ -90,6 +102,7 @@ export const FastFrameTemplate = html<FastFrame>`
: StandardLuminance.LightMode}"
background-color="${x => x.backgroundColor}"
accent-base-color="${x => x.accentColor}"
density="${x => x.density}"
:accentPalette=${x => x.accentPalette}
>
<fast-card>
Expand Down Expand Up @@ -150,11 +163,11 @@ export const FastFrameTemplate = html<FastFrame>`
<div class="control-container">
<fast-button appearance="accent">
Button
<span slot="end">${DownloadIcon}</span>
<span slot="start">${DownloadIcon}</span>
</fast-button>
<fast-button appearance="neutral">
Button
<span slot="end">${PlayIcon}</span>
<span slot="start">${PlayIcon}</span>
</fast-button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export class FastFrame extends FASTElement {
@observable
public accentPalette: string[];

@observable
public density: number = 0;

public accentChangeHandler = (e: any): void => {
const element: HTMLInputElement = e.target;
if (element.checked) {
Expand All @@ -57,6 +60,10 @@ export class FastFrame extends FASTElement {
}
};

public densityChangeHandler = (e: any): void => {
this.density = e.target.value;
};

public themeChange = (e: any): void => {
this.darkMode = !this.darkMode;
if (!this.darkMode) {
Expand Down

0 comments on commit 7bd69b7

Please sign in to comment.