-
Notifications
You must be signed in to change notification settings - Fork 171
/
_layouts_full-width.scss
95 lines (81 loc) · 2.87 KB
/
_layouts_full-width.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// DEPRECATED
// .l-full-width is deprecated, use .l-docs and .l-docs__container instead
@mixin vf-l-full-width {
$l-full-screen-aside-width: 15rem;
// we switch to full screen layout (with side navigation fixed to left side)
// when screen is big enough to fit side nav on left, same size on right, and grid
// in the middle
// we have to calculate media query breakpoint in px instead of rem to make sure
// we take into account bigger font size on large screens
$breakpoint-full-screen-layout: calc(($grid-max-width + 2 * $l-full-screen-aside-width) * $font-size-ratio--largescreen);
// TODO: make sure it works with grid-max-width set to 100% as in
// like: https://github.com/canonical/jaas-dashboard/blob/b9ca3876d054c48dc2da74df0080cd14a0f15740/src/scss/index.scss#L28
@media (min-width: $breakpoint-large) {
// stylelint-disable-next-line selector-max-type
body {
position: relative;
}
.l-full-width__sidebar {
background: $colors--theme--background-alt;
// height of top navigation, as padding applied to .p-navigation__link + line-heigh of the anchor text inside
$navigation-top-height: $spv--large * 2 + map-get($line-heights, default-text);
height: calc(100% - $navigation-top-height); // height of document reduced by height of top nav
min-height: calc(100vh - $navigation-top-height);
position: absolute;
width: $l-full-screen-aside-width;
z-index: 1;
&::after {
background: linear-gradient(90deg, transparent, rgba($color-x-dark, 0.05));
bottom: 0;
content: '';
position: absolute;
right: 0;
top: 0;
width: 8px;
}
// side navigation component drawer needs background only when it's fixed on smaller screens
// keep it transparent when it's visible as part of full width layout
.p-side-navigation__drawer {
background: transparent;
}
}
.l-full-width {
display: grid;
grid-template-areas: 'start main end';
grid-template-columns: $l-full-screen-aside-width minmax(0, 1fr) min-content;
width: 100%;
// left side container
.l-start {
grid-area: start;
}
// main container
.l-main {
grid-area: main;
// grid should align to the left (no left margin)
// TODO: ideally this should be applied to %fixed-width-container
.row,
.grid-row,
.u-fixed-width {
margin-left: 0;
}
}
// right side container
.l-end {
grid-area: end;
}
}
}
// full width layout
@media (min-width: $breakpoint-full-screen-layout) {
.l-full-width {
grid-template-columns: $l-full-screen-aside-width minmax(0, 1fr) $l-full-screen-aside-width;
.l-main {
.row,
.grid-row,
.u-fixed-width {
margin-left: auto;
}
}
}
}
}