Skip to content

Commit

Permalink
feat: create content-placement component for marketing site (#3105)
Browse files Browse the repository at this point in the history
* add hover-card component

* add components to index.html, update component index exports to include hover-card, update main styles so that cards wrap

* updated style to be more layout centric

* rename component and update spacing in styles

* change component name to content-placement

* made style updates so all cards are the same height and body stretches

* replace FAST prefix with site

* update divider attribute to boolean mode and remove true for divider in public index

* updated styles to work woth changes in feature and changes icon styling so there is no unneeded space when slot is not used

* update color for links to match figma using design system
  • Loading branch information
SamanthaAO authored and chrisdholt committed Jun 16, 2020
1 parent 4ab354c commit e569794
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { css } from "@microsoft/fast-element";
import { display } from "@microsoft/fast-components";

export const ContentPlacementStyles = css`
${display("block")} :host {
contain: content;
font-family: var(--body-font);
box-sizing: border-box;
}
:host([hidden]) {
display: none;
}
fast-card {
background: transparent;
padding: 0 calc(var(--design-unit) * 5px) calc(var(--design-unit) * 3px);
text-align: left;
display: flex;
flex-direction: column;
}
fast-card ::slotted([slot="body"]) {
flex: 1 1 auto;
}
fast-card:hover .contentPlacement_footer__hoverVisible {
display: flex;
justify-content: space-between;
align-items: center;
}
.contentPlacement_footer__hoverVisible {
visibility: hidden;
}
fast-card:hover .contentPlacement_footer__hoverVisible {
visibility: visible;
}
fast-card:hover .contentPlacement_divider {
visibility: visible;
}
fast-card:hover .contentPlacement_icon {
visibility: visible;
}
.contentPlacement_divider {
visibility: hidden;
}
fast-card .contentPlacement_icon {
visibility: hidden;
margin-top: calc(var(--design-unit) * 4px);
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { html, when } from "@microsoft/fast-element";
import { ContentPlacement } from "./content-placement";

export const ContentPlacementTemplate = html<ContentPlacement>`<fast-card>
<div
class=${x =>
x.divider
? ""
: "contentPlacement_icon"}
>
<slot name="icon"></slot>
</div>
<slot></slot>
<slot name="body"></slot>
${when(
x => x.divider,
html`<fast-divider class="contentPlacement_divider"></fast-divider>`
)}
<div
class=${x =>
x.divider
? "contentPlacement_footer__hoverVisible"
: "contentPlacement_footer__alwaysVisible"}
>
<slot name="action"></slot>
<slot name="compatibility"></slot>
</div>
</fast-card> `;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { FASTElement, attr } from "@microsoft/fast-element";

export class ContentPlacement extends FASTElement {
@attr({ mode: "boolean" }) divider: boolean = false;
}
14 changes: 14 additions & 0 deletions sites/fast-website/src/app/components/content-placement/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { customElement } from "@microsoft/fast-element";
import { ContentPlacement } from "./content-placement";
import { ContentPlacementTemplate as template } from "./content-placement.template";
import { ContentPlacementStyles as styles } from "./content-placement.styles";

@customElement({
name: "site-content-placement",
template,
styles,
})
export class SiteContentPlacement extends ContentPlacement {}
export * from "./content-placement.template";
export * from "./content-placement.styles";
export * from "./content-placement";
1 change: 1 addition & 0 deletions sites/fast-website/src/app/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { WebsiteDesignSystemProvider } from "./design-system-provider";
export { SiteSectionHeader } from "./section-header";
export { FastFrame } from "./fast-frame";
export { SiteNavigation } from "./navigation";
export { SiteContentPlacement } from "./content-placement";
27 changes: 25 additions & 2 deletions sites/fast-website/src/app/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,33 @@ body {
}

.section-component {
--card-width: 410px;
color: var(--neutral-foreground-rest);
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: center;
height: 600px;
}

/* This creates the blur and background color changes on hover */
/* start */
.section-component:hover site-content-placement{
filter: blur(2px);
}

.section-component:hover site-content-placement:hover{
/* background: linear-gradient(349.8deg, rgba(143, 68, 95, 0.3) 20.91%, rgba(148, 81, 73, 0.3) 99.75%); */
box-shadow: 0px 10px 44px rgba(0, 0, 0, 0.1);
border-radius: var(--design-unit);
filter: blur(0);
}
/* end */

.section-anchor {
color: var(--accent-fill-rest);
}

site-content-placement:hover .section-anchor-hover{
color: var(--accent-fill-rest);
}

.section-badge {
Expand Down
63 changes: 61 additions & 2 deletions sites/fast-website/src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,47 @@
<!-- frameworks:start -->
<section class="section">
<div class="section-component">
Framework components
<site-content-placement divider>
<h3>Angular 8.2.14</h3>
<p slot="body">Angular's default binding syntax will always set properties on an element. This works well for rich data, like objects and arrays, and also works well for primitive values so long as the Custom Element author has mapped any exposed attributes to corresponding properties.</p>
<span slot="compatibility"><img src="https://via.placeholder.com/16" alt="Smiley face"> No issues!</span>
<fast-anchor slot="action" appearance="lightweight" href="#" class="section-anchor">Learn More</fast-anchor>
</site-content-placement>

<site-content-placement divider>
<h3>DIO</h3>
<p slot="body">DIO uses a runtime heuristic to determine if it should pass data to Custom Elements as either properties or attributes. If a property is already defined on the element instance, DIO will use properties, otherwise it will fallback to attributes</p>
<span slot="compatibility"><img src="https://via.placeholder.com/16" alt="Smiley face"> No issues!</span>
<fast-anchor slot="action" appearance="lightweight" href="#" class="section-anchor">Learn More</fast-anchor>
</site-content-placement>

<site-content-placement divider>
<h3>hyperHTML 2.32.2</h3>
<p slot="body">hyperHTML will pass data to an element as properties, as long as the property is defined on the element's prototype. Otherwise it will fallback to passing data as attributes.</p>
<span slot="compatibility"><img src="https://via.placeholder.com/16" alt="Smiley face"> No issues!</span>
<fast-anchor slot="action" appearance="lightweight" href="#" class="section-anchor">Learn More</fast-anchor>
</site-content-placement>

<site-content-placement divider>
<h3>Dojo 6.0.4</h3>
<p slot="body">Dojo will pass data as attributes only when the data is a type of string, otherwise it is set as a property.</p>
<span slot="compatibility"><img src="https://via.placeholder.com/16" alt="Smiley face"> No issues!</span>
<fast-anchor slot="action" appearance="lightweight" href="#" class="section-anchor">Learn More</fast-anchor>
</site-content-placement>

<site-content-placement divider>
<h3>hybrids 4.1.7</h3>
<p slot="body">Hybrids will pass data to an element as properties, as long as the property is defined on the element's prototype. Otherwise it will fallback to passing data as attributes.</p>
<span slot="compatibility"><img src="https://via.placeholder.com/16" alt="Smiley face"> No issues!</span>
<fast-anchor slot="action" appearance="lightweight" href="#"class="section-anchor">Learn More</fast-anchor>
</site-content-placement>

<site-content-placement divider>
<h3>AngularJS (1.x) 1.7.9</h3>
<p slot="body">AngularJS can declaratively pass data to attributes using ng-attr, or to properties using ng-prop.</p>
<span slot="compatibility"><img src="https://via.placeholder.com/16" alt="Smiley face"> No issues!</span>
<fast-anchor slot="action" appearance="lightweight" href="#" class="section-anchor">Learn More</fast-anchor>
</site-content-placement>
</div>
</section>
<!-- frameworks:end -->
Expand Down Expand Up @@ -108,7 +148,26 @@
<!-- community:start -->
<section class="section">
<div class="section-component">
Social community components
<site-content-placement>
<div slot="icon"><img src="https://via.placeholder.com/16" alt="Discord"></div>
<h3>Discord</h3>
<p slot="body">Join our active community on Discord. Follow the latest updates and contributions, ask questions, give feedback, or keep up on our reading list.</p>
<fast-anchor slot="action" appearance="lightweight" href="#" class="section-anchor-hover">Join the Discord Chat</fast-anchor>
</site-content-placement>

<site-content-placement >
<div slot="icon"><img src="https://via.placeholder.com/16" alt="Twitter"></div>
<h3>Twitter</h3>
<p slot="body">Follow along as we share out the latest happenings on Twitter. You will find important updates, announcements, and sneak peeks.</p>
<fast-anchor slot="action" appearance="lightweight" href="#" class="section-anchor-hover">Follow us on Twitter</fast-anchor>
</site-content-placement>

<site-content-placement>
<div slot="icon"><img src="https://via.placeholder.com/16" alt="Github"></div>
<h3>Github</h3>
<p slot="body">Explore the FAST repository on Github and try out our components, utilities, and tools. Or, mix-and-match with your own solutions.</p>
<fast-anchor slot="action" appearance="lightweight" href="https://github.com/microsoft/fast-dna" class="section-anchor-hover">Get Started on Github</fast-anchor>
</site-content-placement>
</div>
</section>
<!-- community:end -->
Expand Down

0 comments on commit e569794

Please sign in to comment.