Skip to content

Commit 96e2848

Browse files
authoredFeb 8, 2021
fix(component-sidenav,component-viewer): fix sticky TOC (#917)
- remove `overflow: hidden` that breaks TOC stickiness - made sure to keep the Material Table examples from overflowing afterwards via changes to `component-viewer.scss` - revert change from #784 to make small breakpoint 939 instead of 959 as it isn't consistent with our Sass breakpoints or the Material layout spec - use alternative to `router-outlet + *` styling - use constants for more media query breakpoints - add some missing Sass imports - move $sidenav-width to constants - update constants to include different horizontal padding for guides and sidenav content - update copyright year - add stylePreprocessorOptions for shorter Sass imports - add .nvmrc since Angular projects only support NodeJS 12 atm Fixes #257
1 parent ebdb66d commit 96e2848

20 files changed

+50
-25
lines changed
 

‎material.angular.io/.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12

‎material.angular.io/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License
22

3-
Copyright (c) 2020 Google LLC.
3+
Copyright (c) 2021 Google LLC.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎material.angular.io/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Versions of this site are also available for
1212
- [v11](https://material.angular.io/)
1313

1414
## Contributing
15+
1516
Please open bugs against the Angular Material and CDK components, directives, documentation
1617
contents, API docs, and demos in the
1718
[Angular Components repo](https://github.com/angular/components/issues).
@@ -22,6 +23,7 @@ navigation not working properly, examples or documentation not being presented i
2223
issues with rendering or layout of the documentation pages, etc.
2324

2425
### Where does the content come from?
26+
2527
The guides, examples, and docs content repo
2628
[angular/material2-docs-content](https://github.com/angular/material2-docs-content) contains the
2729
documentation content and examples. They are generated from:
@@ -30,6 +32,7 @@ documentation content and examples. They are generated from:
3032
- [CDK components, services, and directives](https://github.com/angular/components/tree/master/src/cdk)
3133

3234
## Development Setup
35+
3336
1. Make sure you have [NodeJS LTS](https://nodejs.org) installed
3437
1. Make sure you have [Yarn](https://yarnpkg.com) installed
3538
1. Install the project's dependencies
@@ -38,19 +41,24 @@ documentation content and examples. They are generated from:
3841
- `yarn build:content`
3942

4043
## Development Server
44+
4145
1. Run `yarn start` for a dev server. Navigate to `http://localhost:4200/`.
4246

4347
## Build
48+
4449
Run `yarn prod-build` to build the project.
4550

4651
## Running unit tests
52+
4753
1. Run `yarn test` to execute the unit tests via [Karma](https://karma-runner.github.io).
4854

4955
## Running end-to-end tests
56+
5057
Run `yarn e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
5158
Before running the tests make sure you are serving the app via `yarn start`.
5259

5360
## Deployment instructions
61+
5462
```
5563
> yarn install
5664
> yarn upgrade @angular/components-examples

‎material.angular.io/angular.json

+6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
"bundleName": "assets/purple-green"
7171
}
7272
],
73+
"stylePreprocessorOptions": {
74+
"includePaths": ["node_modules", "src", "src/styles"]
75+
},
7376
"scripts": []
7477
},
7578
"configurations": {
@@ -151,6 +154,9 @@
151154
"bundleName": "assets/purple-green"
152155
}
153156
],
157+
"stylePreprocessorOptions": {
158+
"includePaths": ["node_modules", "src", "src/styles"]
159+
},
154160
"assets": [
155161
{
156162
"glob": "**/*",

‎material.angular.io/src/app/material-docs-app.scss

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import 'constants';
2+
13
material-docs-app {
24
display: flex;
35
flex-direction: column;
@@ -23,9 +25,10 @@ material-docs-app > router-outlet + app-component-sidenav {
2325
-webkit-overflow-scrolling: touch;
2426
}
2527

26-
@media (max-width: 720px) {
28+
@media (max-width: $extra-small-breakpoint-width) {
2729
material-docs-app > router-outlet + .main-content,
2830
material-docs-app > router-outlet + app-component-sidenav {
2931
margin-top: 92px;
32+
overflow-y: visible;
3033
}
3134
}

‎material.angular.io/src/app/pages/component-category-list/_component-category-list-theme.scss

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import '~@angular/material/theming';
2+
13
@mixin component-category-list-theme($theme) {
24
$primary: map-get($theme, primary);
35
$accent: map-get($theme, accent);

‎material.angular.io/src/app/pages/component-sidenav/_component-sidenav-theme.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@import '~@angular/material/theming';
2-
@import '../../../styles/constants';
2+
@import 'constants';
33

44
@mixin component-viewer-sidenav-theme($theme) {
55
$primary: map-get($theme, primary);

‎material.angular.io/src/app/pages/component-sidenav/component-sidenav.scss

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
@import '../../../styles/constants';
2-
3-
$sidenav-width: 240px;
1+
@import 'constants';
42

53
app-component-sidenav {
64
display: flex;
@@ -20,12 +18,6 @@ app-component-sidenav {
2018
.docs-component-sidenav-inner-content {
2119
display: flex;
2220
flex-direction: row;
23-
24-
// The rule will match the element following the router-outlet which will be the routed component.
25-
router-outlet + * {
26-
flex-grow: 1;
27-
overflow: hidden;
28-
}
2921
}
3022

3123
.mat-drawer {

‎material.angular.io/src/app/pages/component-sidenav/component-sidenav.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import {NavigationFocusService} from '../../shared/navigation-focus/navigation-f
4949
// These breakpoint values need to stay in sync with the related Sass variables in
5050
// src/styles/_constants.scss.
5151
const EXTRA_SMALL_WIDTH_BREAKPOINT = 720;
52-
const SMALL_WIDTH_BREAKPOINT = 939;
52+
const SMALL_WIDTH_BREAKPOINT = 959;
5353

5454
@Component({
5555
selector: 'app-component-sidenav',

‎material.angular.io/src/app/pages/component-viewer/component-viewer.scss

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
@import '../../../styles/constants';
1+
@import 'constants';
22

33
app-component-viewer {
44
font-weight: 400;
5+
width: calc(100% - #{$sidenav-width + 1} - #{$content-padding-sidenav * 2});
56

67
// spacing for the component viewer
7-
padding: 20px 50px;
8+
padding: 20px $content-padding-sidenav;
89

10+
// Sidenav is hidden
11+
@media (max-width: $small-breakpoint-width) {
12+
width: calc(100% - #{$content-padding-sidenav * 2});
13+
}
914
@media ($mat-xsmall) {
15+
width: calc(100% - #{$content-padding-side-xs * 2});
1016
padding-left: $content-padding-side-xs;
1117
padding-right: $content-padding-side-xs;
1218
}

‎material.angular.io/src/app/pages/guide-viewer/guide-viewer.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $guide-content-margin-side-xs: 15px;
1212
}
1313

1414
.docs-guide-wrapper {
15-
padding: 20px $content-padding-side 0;
15+
padding: 20px $content-padding-guides-side 0;
1616
display: block;
1717
text-align: center;
1818

‎material.angular.io/src/app/pages/homepage/_homepage-theme.scss

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import '~@angular/material/theming';
2+
13
@mixin home-page-theme($theme) {
24
$primary: map-get($theme, primary);
35
$accent: map-get($theme, accent);

‎material.angular.io/src/styles/_constants.scss

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@ $extra-small-breakpoint-width: 720px;
1111
$small-breakpoint-width: 959px;
1212

1313
/* For desktop, the content should be aligned with the page title. */
14-
$content-padding-side: 70px;
14+
$content-padding-guides-side: 70px;
15+
$content-padding-sidenav: 50px;
1516
$content-padding-side-xs: 15px;
17+
18+
$sidenav-width: 240px;

‎material.angular.io/src/styles/custom-themes/deeppurple-amber.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../app-theme';
1+
@import 'app-theme';
22

33
// Define the light theme.
44
$primary: mat-palette($mat-deep-purple);

‎material.angular.io/src/styles/custom-themes/indigo-pink.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../app-theme';
1+
@import 'app-theme';
22

33
// Define the light theme.
44
$primary: mat-palette($mat-indigo);

‎material.angular.io/src/styles/custom-themes/pink-bluegrey.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../app-theme';
1+
@import 'app-theme';
22
@import '../../highlightjs/material-dark';
33

44
// Define the dark theme.

‎material.angular.io/src/styles/custom-themes/purple-green.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../app-theme';
1+
@import 'app-theme';
22
@import '../../highlightjs/material-dark';
33

44
// Define the dark theme.

‎material.angular.io/tools/audit-docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const MIN_SCORES_PER_PAGE = [
3232
url: '',
3333
minScores: {
3434
'pwa': 70,
35-
'performance': 21,
35+
'performance': 20,
3636
'seo': 98,
3737
'best-practices': 100,
3838
'accessibility': 100

‎material.angular.io/tools/lighthouse-audit.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const AUDIT_CATEGORIES =
1616
const LIGHTHOUSE_FLAGS = {
1717
logLevel : process.env.CI ? 'error' : 'info'
1818
}; // Be less verbose on CI.
19-
const SKIPPED_HTTPS_AUDITS = [ 'redirects-http', 'uses-http2', 'uses-long-cache-ttl', 'canonical' ];
19+
const SKIPPED_HTTPS_AUDITS = [
20+
'redirects-http', 'uses-http2', 'uses-long-cache-ttl', 'canonical', 'uses-text-compression'
21+
];
2022
const VIEWER_URL = 'https://googlechrome.github.io/lighthouse/viewer';
2123
const WAIT_FOR_SW_DELAY = 5000;
2224

‎material.angular.io/yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@
217217
tslib "^2.0.0"
218218

219219
"@angular/components-examples@angular/material2-docs-content#11.1.x":
220-
version "11.1.1-sha-512fadee3"
221-
resolved "https://codeload.github.com/angular/material2-docs-content/tar.gz/571f76abef528143be21486398c74215fb3579ad"
220+
version "11.1.2-sha-f182db529"
221+
resolved "https://codeload.github.com/angular/material2-docs-content/tar.gz/d36453ef80e7066c93f75729a8597f370b5b6a65"
222222
dependencies:
223223
tslib "^2.0.0"
224224

0 commit comments

Comments
 (0)
Please sign in to comment.