Skip to content

Commit

Permalink
feat: add feature-card and card-section components (#3119)
Browse files Browse the repository at this point in the history
* Add feature card component

* Add feature card section

* Add feature card section to index.html

* Update card styles

* change links slot to footer

* Add neutralForegroundRestBehavior to feature-card

* Remove unused css custom property

* Add ::before separator element to cards

* feat: add accent color and background color selection (#3123)

* feat: add color pickers and preview

* formatting

* added dark / light mode

* add prettier

* ran prettier

* saved last index for selecting background

* addressed Rob's comments

* ran prettier

* addressed comments

* styling fixes

* fix file formatting

* fix import

* formatting issue

* formatting

* fix tabs to spaces

* change selector from h5 to :first-child

* Append Site prefix

* make feature-card responsive

* remove style property

* fix import and closing tags

* remove fast-anchor color

* refactor card elements

* modify class extension

Co-authored-by: Michael Benson <[email protected]>
Co-authored-by: Jeff Smith <[email protected]>
  • Loading branch information
3 people authored and chrisdholt committed Jun 16, 2020
1 parent b843689 commit 7ebd643
Show file tree
Hide file tree
Showing 10 changed files with 218 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { css } from "@microsoft/fast-element";
import { display } from "@microsoft/fast-components";

export const CardSectionStyles = css`
:host {
--flow: column;
}
@media screen and (max-width: 1000px) {
:host {
--flow: row;
}
}
${display("grid")} :host {
grid-template-rows: repeat(4, min-content);
grid-auto-flow: var(--flow);
}
:host(:hover) ::slotted(site-feature-card) {
filter: blur(1px);
}
:host ::slotted(site-feature-card:hover) {
filter: blur(0);
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { html } from "@microsoft/fast-element";
import { CardSection } from "./card-section";

export const CardSectionTemplate = html<CardSection>`<slot></slot>`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { FASTElement } from "@microsoft/fast-element";

export class CardSection extends FASTElement {}
14 changes: 14 additions & 0 deletions sites/fast-website/src/app/components/card-section/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { customElement } from "@microsoft/fast-element";
import { CardSectionTemplate as template } from "./card-section.template";
import { CardSectionStyles as styles } from "./card-section.styles";
import { CardSection } from "./card-section";

@customElement({
name: "site-card-section",
template,
styles,
})
export class SiteCardSection extends CardSection {}
export * from "./card-section.template";
export * from "./card-section.styles";
export * from "./card-section";
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { css } from "@microsoft/fast-element";
import { display, neutralForegroundRestBehavior } from "@microsoft/fast-components";

export const FeatureCardStyles = css`
${display("grid")} :host {
contain: layout;
grid-template-columns: repeat(3, minmax(150px, 1fr));
grid-template-areas: "header main main";
color: inherit;
box-sizing: border-box;
padding: 20px;
box-shadow: unset;
}
:host::before {
content: "";
display: block;
background-color: currentColor;
position: fixed;
height: 1px;
width: 93%;
left: 20px;
top: 0;
}
:host(:hover) ::slotted(fast-anchor) {
opacity: 1;
}
:host(:hover)::before {
opacity: 0;
}
:host(:hover) ::slotted(:first-child) {
color: var(--accent-fill-rest);
}
@media screen and (max-width: 540px) {
${display("grid")} :host {
grid-template-columns: repeat(3, minmax(50px, 1fr));
grid-template-areas:
"header header header"
"main main main";
}
}
.card_heading {
grid-area: header;
padding-bottom: 10px;
}
.card_body {
display: flex;
flex-direction: column;
justify-content: space-between;
grid-area: main;
}
::slotted(h4) {
font-size: 20px;
margin: 0;
}
::slotted(:first-child) {
font-weight: bold;
margin: 0 0 10px 0;
}
::slotted(p) {
margin: 0;
}
::slotted(fast-anchor) {
margin-right: 20px;
opacity: 0;
}
`.withBehaviors(neutralForegroundRestBehavior);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { html } from "@microsoft/fast-element";
import { FeatureCard } from "./feature-card";

export const FeatureCardTemplate = html<FeatureCard>`
<div class="card_heading">
<slot></slot>
</div>
<div class="card_body">
<slot name="body"></slot>
<div>
<slot name="footer"></slot>
</div>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { FASTCard as Card } from "@microsoft/fast-components";

export class FeatureCard extends Card {}
14 changes: 14 additions & 0 deletions sites/fast-website/src/app/components/feature-card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { customElement } from "@microsoft/fast-element";
import { FeatureCardTemplate as template } from "./feature-card.template";
import { FeatureCardStyles as styles } from "./feature-card.styles";
import { FeatureCard } from "./feature-card";

@customElement({
name: "site-feature-card",
template,
styles,
})
export class SiteFeatureCard extends FeatureCard {}
export * from "./feature-card.template";
export * from "./feature-card.styles";
export * from "./feature-card";
2 changes: 2 additions & 0 deletions sites/fast-website/src/app/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ export { FastFrame } from "./fast-frame";
export { SiteNavigation } from "./navigation";
export { SiteContentPlacement } from "./content-placement";
export { SiteContentPlacementContainer } from "./content-placement-container";
export { SiteFeatureCard } from "./feature-card";
export { SiteCardSection } from "./card-section";
63 changes: 60 additions & 3 deletions sites/fast-website/src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

<!-- frameworks:start -->
<section class="section">
<site-content-placement-container section="framework"></fast-content-card-container>
<site-content-placement-container section="framework"></site-content-placement-container>
</section>
<!-- frameworks:end -->

Expand All @@ -89,7 +89,64 @@
<!-- documentation:start -->
<section class="section">
<div class="section-component">
Documentation components
<site-card-section>
<site-feature-card>
<div>01</div>
<h4>Composition</h4>
<p slot="body">Create new component compositions by nesting, styling base components, and passing unhandled props. The combinations are endless.</p>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">View Github</fast-anchor>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">Read Documentation</fast-anchor>
</site-feature-card>
<site-feature-card>
<div>02</div>
<h4>Design Systems</h4>
<p slot="body">Use Fluent by default or customize design system properties to make it your own. Or, create your own design system to use with FAST components.</p>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">View Github</fast-anchor>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">Read Documentation</fast-anchor>
</site-feature-card>
<site-feature-card>
<div>03</div>
<h4>Technology</h4>
<p slot="body">Out of the box, FAST components are built on React, but you can build components on any modern framework using the FAST system.</p>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">View Github</fast-anchor>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">Read Documentation</fast-anchor>
</site-feature-card>
<site-feature-card>
<div>04</div>
<h4>Web Standards</h4>
<p slot="body">All FAST components follow WCAG 2.1, are W3C spec-compliant and use the W3C interaction models when available.</p>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">View Github</fast-anchor>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">Read Documentation</fast-anchor>
</site-feature-card>
<site-feature-card>
<div>05</div>
<h4>Animation</h4>
<p slot="body">Design sophisticated animation sequences with the animation library, an interface for the Web Animations API.</p>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">View Github</fast-anchor>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">Read Documentation</fast-anchor>
</site-feature-card>
<site-feature-card>
<div>06</div>
<h4>Colors</h4>
<p slot="body">Create color palettes, extract colors from images, and handle other color operations using our color library.</p>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">View Github</fast-anchor>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">Read Documentation</fast-anchor>
</site-feature-card>
<site-feature-card>
<div>07</div>
<h4>Layout / Grid</h4>
<p slot="body">Build layouts such as a 12 column grid for content or an application grid with resizable panels.</p>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">View Github</fast-anchor>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">Read Documentation</fast-anchor>
</site-feature-card>
<site-feature-card>
<div>08</div>
<h4>Other</h4>
<p slot="body">Leverage a toolkit of general utilities such as keyboarding, Right-To-Left (RTL), number, and string manipulation.</p>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">View Github</fast-anchor>
<fast-anchor slot="footer" class="link" href="#" appearance="lightweight">Read Documentation</fast-anchor>
</site-feature-card>
</site-card-section>
</div>
</section>
<!-- documentation:end -->
Expand All @@ -105,7 +162,7 @@

<!-- community:start -->
<section class="section">
<site-content-placement-container section="community"></fast-content-card-container>
<site-content-placement-container section="community"></site-content-placement-container>
</section>
<!-- community:end -->

Expand Down

0 comments on commit 7ebd643

Please sign in to comment.