Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/material-docs-app.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<app-navbar [class.mat-elevation-z6]="showShadow"></app-navbar>
<app-navbar class="mat-elevation-z6"></app-navbar>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way to only make the elevation show once the page has been scrolled and stickiness has taken effect? If not, I think showShadow can be refactored out of the component class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe its worth the effort to make the elevation only when scrolled, especially since we are faking the stickiness of the header. I have removed showShadow as you mentioned.

<router-outlet></router-outlet>
5 changes: 5 additions & 0 deletions src/app/material-docs-app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ material-docs-app > app-component-sidenav {
flex: 1 1 auto;
}

// Target last-child as it will be the output of the router-outlet within the app's container.
material-docs-app > :last-child {
overflow-y: auto;
}

app-navbar {
position: relative;
z-index: 10;
Expand Down
6 changes: 0 additions & 6 deletions src/app/material-docs-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ import 'rxjs/add/operator/filter';
encapsulation: ViewEncapsulation.None,
})
export class MaterialDocsApp {
showShadow = false;

constructor(router: Router) {
const routesWithNavbarShadow = ['/categories', '/components'];

let previousRoute = router.routerState.snapshot.url;

router.events
.filter(event => event instanceof NavigationEnd )
.subscribe((data: NavigationEnd) => {
this.showShadow = !!routesWithNavbarShadow
.find(route => data.urlAfterRedirects.startsWith(route));

// We want to reset the scroll position on navigation except when navigating within
// the documentation for a single component.
if (!isNavigationWithinComponentView(previousRoute, data.urlAfterRedirects)) {
Expand Down
8 changes: 8 additions & 0 deletions src/app/pages/component-viewer/component-overview.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@import '../../../styles/constants';

component-overview {
@media (max-width: $small-breakpoint-width) {
display: flex;
flex-direction: column;
}
}
5 changes: 4 additions & 1 deletion src/app/pages/component-viewer/component-viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ app-component-viewer {
top: 35px;

@media (max-width: $small-breakpoint-width) {
display: none;
display: flex;
order: -1;
position: inherit;
width: auto;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/app/pages/component-viewer/component-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class ComponentViewer {
@Component({
selector: 'component-overview',
templateUrl: './component-overview.html',
styleUrls: ['./component-overview.scss'],
encapsulation: ViewEncapsulation.None,
})
export class ComponentOverview {
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/guide-viewer/guide-viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $guide-content-margin-side-xs: 15px;
}

.docs-guide-toc-and-content {
display: inline-block;
display: block;
text-align: left;
max-width: 940px;
}
Expand Down
27 changes: 23 additions & 4 deletions src/app/pages/homepage/homepage.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
// The margin between two sections
$margin-promotion-sections: 60px;
$margin-promotion-sections-small: 15px;

.docs-header-background {
height: 300px;
margin-bottom: 40px;
overflow: hidden;
}

.docs-header-section {
text-align: center;
padding-top: 60px;
padding-top: $margin-promotion-sections;
}

.docs-header-headline {
h1 {
font-size: 56px;
font-weight: 300;
line-height: 56px;
margin: 15px 0 15px 0;
margin: 15px 5px;
}

h2 {
Expand Down Expand Up @@ -85,3 +85,22 @@ $margin-promotion-sections: 60px;
flex-direction: column;
justify-content: center;
}


/**
* Rules for when the device is detected to be a small screen.
*/
@media (max-width: 720px) {
.docs-header-section {
padding-top: $margin-promotion-sections-small;
}

.docs-header-start,
.docs-homepage-bottom-start {
margin: $margin-promotion-sections-small 0;
}

.docs-homepage-row {
margin: $margin-promotion-sections-small 0;
}
}
2 changes: 1 addition & 1 deletion src/app/shared/navbar/_navbar-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
app-navbar {
color: mat-color($primary, default-contrast);

.docs-navbar {
.docs-navbar, .docs-navbar-header {
background: mat-color($primary);
}
}
Expand Down
29 changes: 20 additions & 9 deletions src/app/shared/navbar/navbar.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
<!-- TODO: figure out if the <nav> should go inside of a <header> element. -->
<nav class="docs-navbar">
<nav class="docs-navbar-header">
<a md-button class="docs-button" routerLink="/" aria-label="Angular Material">
<img class="docs-angular-logo"
src="../../../assets/img/homepage/angular-white-transparent.svg"
alt="angular">
src="../../../assets/img/homepage/angular-white-transparent.svg"
alt="angular">
<span>Material</span>
</a>
<a md-button class="docs-button" routerLink="components">Components</a>
<a md-button class="docs-button" routerLink="guides">Guides</a>
<a md-button class="docs-navbar-hide-small docs-button" routerLink="components">Components</a>
<a md-button class="docs-navbar-hide-small docs-button" routerLink="guides">Guides</a>
<div class="flex-spacer"></div>
<theme-picker></theme-picker>
<a md-button class="docs-button" href="https://github.com/angular/material2" aria-label="GitHub Repository">
<img class="docs-github-logo"
src="../../../assets/img/homepage/github-circle-white-transparent.svg"
alt="GitHub">
<a md-button class="docs-button docs-navbar-hide-small" href="https://github.com/angular/material2"
aria-label="GitHub Repository">
<img class="docs-angular-logo"
src="../../../assets/img/homepage/github-circle-white-transparent.svg"
alt="angular">
GitHub
</a>
<a md-icon-button class="docs-button docs-navbar-show-small"
href="https://github.com/angular/material2" aria-label="GitHub Repository">
<img class="docs-angular-logo"
src="../../../assets/img/homepage/github-circle-white-transparent.svg"
alt="angular">
</a>
</nav>
<nav class="docs-navbar docs-navbar-show-small">
<a md-button class="docs-navbar-link" routerLink="components">Components</a>
<a md-button class="docs-navbar-link" routerLink="guides">Guides</a>
</nav>
37 changes: 36 additions & 1 deletion src/app/shared/navbar/navbar.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.docs-navbar {
.docs-navbar-header {
display: flex;
flex-wrap: wrap;
align-items: center;
Expand Down Expand Up @@ -26,3 +26,38 @@
margin: 0 7px 2px 0;
vertical-align: middle;
}

.docs-navbar-link {
text-decoration: inherit;
flex: 1;
}

.docs-navbar {
display: none;
}

.docs-navbar-show-small {
display: none;
}

/**
* Rules for when the device is detected to be a small screen.
* Moves content two rows instead of one.
*/
@media (max-width: 720px) {
.docs-navbar-hide-small {
display: none;
}

.docs-navbar-show-small {
display: block;
}

.docs-navbar {
display: flex;
}

.docs-navbar--github-logo {
margin: 0;
}
}
8 changes: 1 addition & 7 deletions src/app/shared/navbar/navbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,5 @@ describe('NavBar', () => {
fixture.detectChanges();
});

it('should have a link to material github', () => {
const githublink = 'https://github.com/angular/material2';
const links = fixture
.nativeElement.querySelectorAll('.docs-navbar .mat-button');
const link = links[links.length - 1];
expect(link.getAttribute('href')).toEqual(githublink);
});
// Note: Add tests is logic is added to navbar class.
});
5 changes: 3 additions & 2 deletions src/app/shared/navbar/navbar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Component, NgModule} from '@angular/core';
import {MdButtonModule} from '@angular/material';
import {DomSanitizer} from '@angular/platform-browser';
import {MdButtonModule, MdMenuModule} from '@angular/material';
import {RouterModule} from '@angular/router';
import {ThemePickerModule} from '../theme-picker/theme-picker';

Expand All @@ -11,7 +12,7 @@ import {ThemePickerModule} from '../theme-picker/theme-picker';
export class NavBar {}

@NgModule({
imports: [MdButtonModule, RouterModule, ThemePickerModule],
imports: [MdButtonModule, MdMenuModule, RouterModule, ThemePickerModule],
exports: [NavBar],
declarations: [NavBar],
})
Expand Down
5 changes: 5 additions & 0 deletions src/styles/_api-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
display: none !important;
}

// Prevent p tags from not breaking, causing x axis overflows.
.docs-api > p {
word-break: break-word;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why direct child?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did direct child because it is the case we are seeing in the issue with. My concern with doing all indirect matching was messing up how the code formatted boxes handled word and line breaks.


.docs-api-class-name,
.docs-api-module-import,
.docs-api-class-selector-name,
Expand Down
4 changes: 2 additions & 2 deletions src/styles/_constants.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '../../node_modules/@angular/material/theming';

$small-breakpoint-width: 840px;
$small-breakpoint-width: 720px;

/* For desktop, the content should be aligned with the page title. */
$content-padding-side: 70px;
$content-padding-side-xs: 15px;
$content-padding-side-xs: 15px;
3 changes: 2 additions & 1 deletion src/styles/_general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ pre {
font-size: 30px;
font-weight: 300;
margin: 0;
padding: 50px;
padding: 28px 8px;
font-size: 20px;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/styles/_markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@

.docs-markdown-pre {
border-radius: 5px;
margin: 16px auto;
display: block;
margin: 16px auto;
overflow-x: auto;
padding: 20px;

.docs-markdown-code {
Expand Down
20 changes: 20 additions & 0 deletions src/styles/_tables.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import './constants';

.docs-api table,
.docs-markdown-table {
border-collapse: collapse;
Expand All @@ -21,3 +23,21 @@
font-weight: 400;
padding: 8px 16px;
}


@media (max-width: $small-breakpoint-width) {
.docs-api table,
.docs-markdown-table {
margin: 0 0 32px 0;
}

.docs-api th,
.docs-markdown-th {
padding: 6px 16px;
}

.docs-api td,
.docs-markdown-td {
padding: 4px 8px;
}
}