Skip to content

Commit e3d6968

Browse files
willshowelljelbourn
authored andcommittedNov 3, 2017
fix: consistent toc positioning (#316)
* fix(toc): align toc left and use same styles for overview and api * fix(guides): make toc sticky and position on top for small screens
1 parent 081ce2f commit e3d6968

File tree

5 files changed

+29
-18
lines changed

5 files changed

+29
-18
lines changed
 

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
font-weight: bold;
66
font-size: 20px;
77
background: none;
8-
8+
99
code {
1010
background: none;
1111
}

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

-10
This file was deleted.

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

+14
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,27 @@ app-component-viewer {
2727
position: relative;
2828
min-height: 500px;
2929

30+
// Display outlet components with toc as flex and switch to
31+
// vertical direction on small screens
32+
component-overview, component-api {
33+
display: flex;
34+
align-items: flex-start;
35+
36+
@media (max-width: $small-breakpoint-width) {
37+
flex-direction: column;
38+
}
39+
}
40+
3041
table-of-contents {
3142
top: 35px;
3243

44+
// Reposition on top of content on small screens and remove
45+
// sticky positioning
3346
@media (max-width: $small-breakpoint-width) {
3447
order: -1;
3548
position: inherit;
3649
width: auto;
50+
padding-left: 0;
3751
}
3852
}
3953
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ export class ComponentViewer {
4747
@Component({
4848
selector: 'component-overview',
4949
templateUrl: './component-overview.html',
50-
styleUrls: ['./component-overview.scss'],
5150
encapsulation: ViewEncapsulation.None,
5251
})
5352
export class ComponentOverview implements OnInit {

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

+14-6
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,20 @@ $guide-content-margin-side-xs: 15px;
2323
}
2424

2525
.docs-guide-toc-and-content {
26-
display: block;
26+
display: flex;
27+
align-items: flex-start;
28+
2729
text-align: left;
2830
max-width: 940px;
2931
margin: 0 auto;
32+
33+
@media (max-width: $small-breakpoint-width) {
34+
flex-direction: column;
35+
}
3036
}
3137

3238
.docs-guide-content {
33-
display: block;
34-
float: left;
39+
flex-grow: 1;
3540
width: 80%;
3641

3742
@media (max-width: $small-breakpoint-width) {
@@ -41,10 +46,13 @@ $guide-content-margin-side-xs: 15px;
4146

4247
table-of-contents {
4348
top: 35px;
44-
float: right;
45-
width: 15%;
4649

50+
// Reposition on top of content on small screens and remove
51+
// sticky positioning
4752
@media (max-width: $small-breakpoint-width) {
48-
display: none;
53+
order: -1;
54+
position: inherit;
55+
width: auto;
56+
padding-left: 0;
4957
}
5058
}

0 commit comments

Comments
 (0)
Please sign in to comment.