Skip to content

Commit

Permalink
add slotted for nav items
Browse files Browse the repository at this point in the history
  • Loading branch information
khamudom committed May 12, 2020
1 parent cc52f3c commit 1eaf9c4
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { SiteNavigationStyles as styles } from "./site-navigation.styles";
template,
styles,
})
export class FASTSectionHeader extends SiteNavigation {}
export class FASTSiteNavigation extends SiteNavigation {}
export * from "./site-navigation.template";
export * from "./site-navigation.styles";
export * from "./site-navigation";
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { html, repeat } from "@microsoft/fast-element";
import { html, slotted } from "@microsoft/fast-element";
import { SiteNavigation } from "./site-navigation";

export const SiteNavigationTemplate = html<SiteNavigation>`
<template>
<nav>
<ul>
${repeat(
x => x.items,
html` <li><fast-anchor>Component</fast-anchor></li> `
)}
</ul>
<slot></slot>
<slot ${slotted("items")}></slot>
</nav>
</template>
`;
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { FASTElement, attr, observable } from "@microsoft/fast-element";
import { FASTElement, observable } from "@microsoft/fast-element";

export class SiteNavigation extends FASTElement {
@attr
public item: string;

@observable
public items: string[] = [];
items: HTMLElement[];

public connectedCallback(): void {
super.connectedCallback();
this.items.forEach((item: any) => {
if (item instanceof HTMLElement) {
item.setAttribute("role", "listitem");
}
});
}
}
48 changes: 23 additions & 25 deletions sites/fast-website/src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
<div class="wrapper">
<!-- header:start -->
<header class="header">
<fast-anchor href="#" appearance="lightweight">Logo</fast-anchor>
<div class="header-link-group">
<fast-site-navigation>Component</fast-site-navigation>
<fast-anchor href="#" appearance="lightweight">Component</fast-anchor>
<fast-anchor href="#" appearance="lightweight">Integration</fast-anchor>
<fast-anchor href="#" appearance="lightweight">Documentation</fast-anchor>
<fast-anchor href="#" appearance="lightweight">Community</fast-anchor>
</div>
<fast-anchor href="#" appearance="lightweight">Github</fast-anchor>
<fast-anchor href="#" appearance="lightweight">FAST</fast-anchor>
<fast-site-navigation>
<fast-anchor class="header-navigation-item" appearance="lightweight" href="#">Components</fast-anchor>
<fast-anchor class="header-navigation-item" appearance="lightweight" href="#">Integration</fast-anchor>
<fast-anchor class="header-navigation-item" appearance="lightweight" href="#">Documentation</fast-anchor>
<fast-anchor class="header-navigation-item" appearance="lightweight" href="#">Community</fast-anchor>
</fast-site-navigation>
<fast-anchor href="#" appearance="lightweight">
Github
<svg width="19" height="20" viewBox="0 0 19 20" xmlns="http://www.w3.org/2000/svg">
<path d="M6.71154 17.0776C2.09615 18.4906 2.09615 14.7226 0.25 14.2517L6.71154 17.0776ZM13.1731 19.9036V16.2581C13.2077 15.8089 13.1482 15.3574 12.9986 14.9335C12.849 14.5096 12.6127 14.123 12.3054 13.7995C15.2038 13.4698 18.25 12.3489 18.25 7.20563C18.2498 5.89046 17.754 4.62572 16.8654 3.67319C17.2862 2.52257 17.2564 1.25074 16.7823 0.121918C16.7823 0.121918 15.6931 -0.207776 13.1731 1.51605C11.0574 0.930913 8.82722 0.930913 6.71154 1.51605C4.19154 -0.207776 3.10231 0.121918 3.10231 0.121918C2.62819 1.25074 2.59844 2.52257 3.01923 3.67319C2.12396 4.63279 1.62771 5.90895 1.63462 7.23389C1.63462 12.3394 4.68077 13.4604 7.57923 13.8278C7.27554 14.148 7.04132 14.5299 6.89182 14.9486C6.74233 15.3674 6.6809 15.8135 6.71154 16.2581V19.9036" />
</svg>
</fast-anchor>
</header>
<!-- header:end -->

Expand Down Expand Up @@ -107,22 +111,16 @@
<!-- community:end -->

<!-- footer:start -->
<footer class="footer">
<fast-divider></fast-divider>
<fast-anchor href="#" appearance="lightweight">Logo</fast-anchor>
<div class="footer-links">
<div class="footer-link-group">
<span>License</span>
<span>Privacy</span>
<span>Terms of use</span>
<span>&copy; 2020 Microsoft</span>
</div>
<div class="footer-link-group">
<fast-anchor href="#" appearance="lightweight">Medium</fast-anchor>
<fast-anchor href="#" appearance="lightweight">Github</fast-anchor>
</div>
</div>
</footer>
<fast-divider class="divider"></fast-divider>
<div class="footer">
<fast-site-navigation>
<fast-anchor class="footer-navigation-item" appearance="lightweight" href="#">License</fast-anchor>
<fast-anchor class="footer-navigation-item" appearance="lightweight" href="#">Privacy & Cookies</fast-anchor>
<fast-anchor class="footer-navigation-item" appearance="lightweight" href="#">Terms of Use</fast-anchor>
<fast-anchor class="footer-navigation-item" appearance="lightweight" href="#">&copy; 2020 Microsoft</fast-anchor>
</fast-site-navigation>
<fast-anchor href="#" appearance="lightweight">FAST</fast-anchor>
</div>
<!-- footer:end -->
</div>
</fast-design-system-provider>
Expand Down
38 changes: 22 additions & 16 deletions sites/fast-website/src/public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ body {
height: 80px;
}

.header-navigation-item {
margin: 0 30px;
}

.section {
grid-column: 2;
}
Expand All @@ -36,21 +40,6 @@ body {
background-color: #3A3A3A;
}

.footer {
grid-column: 2;
height: 240px;
margin-top: 100px
}

.footer-links {
display: flex;
justify-content: space-between;
}

.footer-copyright-group {
display: flex;
}

.section-badge {
font-weight: bold;
}
Expand All @@ -65,4 +54,21 @@ body {
font-size: 46px;
line-height: 56px;
margin: 0;
}
}

.divider {
grid-column: 2;
margin-top: 100px;
margin-bottom: 60px;
}

.footer {
grid-column: 2;
display: flex;
justify-content: space-between;
margin-bottom: 84px;
}

.footer-navigation-item {
margin-right: 50px;
}

0 comments on commit 1eaf9c4

Please sign in to comment.