UNPKG

8.61 kBtext/lessView Raw
1@import 'aui-sidebar-config.less';
2
3//
4// Imported by aui-sidebar.
5//
6// Implements the base container styles for the sidebar, so it works
7// on various screen widths and devices. The sidebar has an expanded
8// and contracted mode, whose skeleton structure is styled here.
9//
10
11//
12// The sidebar widths
13// managed by CSS variables for great fun and profit!
14//
15.aui-page-sidebar {
16 --aui-sidebar-width: @aui-sidebar-width;
17
18 &.aui-sidebar-collapsed {
19 --aui-sidebar-width: @aui-sidebar-collapsed-width;
20 }
21}
22
23//
24// The sidebar skeleton
25//
26.aui-sidebar {
27 #aui.box-sizing();
28 min-width: @aui-sidebar-collapsed-width;
29 position: absolute;
30
31 // when the sidebar sits over the content
32 &.aui-sidebar-fly-out {
33 --aui-sidebar-width: @aui-sidebar-width;
34
35 .aui-page-sidebar-touch & {
36 border-right: 1px solid @aui-sidebar-border-color;
37 height: 100%;
38 position: absolute;
39 }
40 }
41
42 //
43 // The content container inside the sidebar.
44 //
45 .aui-sidebar-wrapper {
46 #aui.box-sizing();
47 border-right: 0;
48 border-color: @aui-sidebar-border-color;
49 background-color: @aui-sidebar-background-color;
50 display: flex;
51 flex-direction: column;
52 width: var(--aui-sidebar-width);
53
54 // The sidebar sits within its container in fun ways.
55 position: absolute;
56 top: 0;
57 bottom: auto;
58 // explicit z-index needed in order to appear over the top of page layout's #content and #footer on the sidebar's RHS.
59 // they use padding-left to "make space" for sidebar, meaning their background-color bleeds over the top of sidebar.
60 z-index: 1;
61
62 &.aui-is-docked {
63 position: fixed;
64 }
65 }
66
67 // Adjustments for mobile devices
68 .aui-page-sidebar-touch & {
69 background: var(--aui-body-background);
70 float: left;
71
72 .aui-sidebar-wrapper {
73 border-right: none;
74 position: static;
75 }
76 }
77
78 // Tweak existing page-header when shown inside the sidebar
79 .aui-page-header {
80 margin: (@aui-sidebar-spacing) (@aui-sidebar-spacing) 0 (@aui-sidebar-spacing);
81 padding-bottom: 0;
82 position: relative;
83
84 .aui-page-header-image {
85 position: absolute;
86 }
87
88 .aui-avatar {
89 display: block;
90 }
91 }
92
93 .aui-page-header-inner,
94 .aui-page-header-image,
95 .aui-page-header-main {
96 display: block;
97 }
98
99 .aui-page-header-image {
100 + .aui-page-header-main {
101 padding-left: (@aui-sidebar-grid + @aui-avatar-size-large);
102 }
103 }
104
105 .aui-sidebar-header-large {
106 .aui-page-header-image {
107 width: @aui-avatar-size-xxxlarge;
108 margin: 0 auto;
109 position: inherit;
110
111 + .aui-page-header-main {
112 padding-top: @aui-sidebar-grid;
113 padding-left: 0;
114 }
115 }
116
117 .aui-page-header-main {
118 text-align: center;
119
120 > h1,
121 > h2 {
122 #aui.typography.h700();
123 padding-top: @aui-sidebar-grid;
124
125 &:only-child {
126 padding-top: 0;
127 }
128 }
129 }
130 }
131
132 .aui-page-header-main {
133 padding-top: (@aui-avatar-size-large - (@aui-sidebar-base-line-height * 2)) / 2; // avatar - 2 lines of heading text divided by 2 for top and bottom padding to center it vertically
134
135 > h1,
136 > h2 {
137 #aui.typography.h500();
138 #aui.text-truncate();
139 line-height: @aui-sidebar-base-line-height;
140
141 &:only-child {
142 line-height: @aui-avatar-size-large;
143 }
144 }
145 }
146
147 .aui-page-header-actions {
148 display: none; // page header actions should be rendered as a list under the main <nav class="aui-navgroup-vertical">
149 }
150
151 .aui-nav-breadcrumbs > li {
152 width: 100%;
153 }
154 // END page header tweaks
155
156 // optional handle to adjust the width of the sidebar
157 .aui-sidebar-handle {
158 @sidebar-handle-width: @aui-sidebar-grid;
159 background: @aui-panel-bg-color url(images/icons/sidebar/icon-handle.png) center center no-repeat;
160 cursor: col-resize;
161 height: 100%;
162 position: absolute;
163 right: -@sidebar-handle-width;
164 top: 0;
165 width: @sidebar-handle-width;
166 }
167
168 //
169 // Sidebar body and footer content containers.
170 //
171
172 .aui-sidebar-body {
173 #aui.box-sizing(content-box);
174 flex-grow: 1; // so the footer is pushed to the bottom of the sidebar container.
175 overflow-y: auto;
176 }
177
178 .aui-sidebar-footer {
179 #aui.box-sizing();
180 border-top: 1px solid @aui-sidebar-border-color;
181 display: flex;
182 flex-direction: row-reverse;
183 flex-shrink: 0; // so the items don't get smaller as the browser height shrinks.
184 justify-content: space-between;
185 min-height: @aui-sidebar-footer-height;
186 padding: (@aui-sidebar-spacing - @aui-sidebar-gutter) @aui-sidebar-gutter;
187
188 .aui-page-sidebar-touch & {
189 border-bottom: 1px solid @aui-sidebar-border-color;
190 margin-top: @aui-sidebar-grid;
191 }
192
193 .aui-button {
194 #aui.text-truncate();
195 max-width: 100%;
196
197 ~ .aui-button {
198 margin-left: 0;
199 }
200 }
201
202 > .aui-sidebar-toggle {
203 order: -1;
204 }
205 }
206
207 //-----------------------
208 // Sidebar narrow state - add collapsed styles.
209 // Note: the width is "automatically" shrunk thanks to the CSS variable.
210 //-----------------------
211 &[aria-expanded="false"] {
212 .aui-sidebar-body {
213 overflow-x: hidden; // don't show horizontal scrollbar in collapsed state.
214 }
215
216 .aui-page-header-inner .aui-page-header-image {
217 align-content: center;
218 display: flex;
219 justify-content: center;
220 position: relative;
221 width: auto;
222 }
223
224 .aui-page-header {
225 margin-left: 0;
226 margin-right: 0;
227
228 .aui-avatar,
229 .aui-avatar .aui-avatar-inner {
230 height: @aui-sidebar-header-avatar-collapsed;
231 width: @aui-sidebar-header-avatar-collapsed;
232 }
233
234 .aui-avatar .aui-avatar-inner > img {
235 max-height: @aui-sidebar-header-avatar-collapsed;
236 max-width: @aui-sidebar-header-avatar-collapsed;
237 }
238 }
239
240 .aui-page-header-main {
241 display: none;
242 }
243
244 .aui-sidebar-body {
245 #aui.box-sizing();
246 bottom: @aui-sidebar-footer-height * 2;
247 padding: 0;
248 width: 100%;
249 }
250
251 // Adjust the sidebar footer for the collapsed state
252 .aui-sidebar-footer {
253 overflow: hidden;
254 flex-direction: column-reverse;
255
256 > .aui-sidebar-toggle {
257 > .aui-icon {
258 #aui.rotate(180deg);
259 }
260 }
261
262 > .aui-button {
263 padding-left: 0;
264 padding-right: 0;
265 text-align: center;
266 // override the text-overflow truncation on aui-button when sidebar is collapsed
267 text-overflow: clip;
268 white-space: normal;
269
270 > .aui-button-label {
271 display: none;
272 }
273 }
274 }
275 }
276 // END Collapsed state
277
278 // Animations
279 &.aui-is-animated {
280 .aui-sidebar-wrapper {
281 #aui.transition(width @aui-sidebar-default-transition-timing ease-in-out);
282 }
283
284 .aui-sidebar-body {
285 #aui.transition(padding-top @aui-sidebar-default-transition-timing ease-in-out);
286 }
287 }
288}
289// END Sidebar
290//-----------------------
291
292// Page Layout + Sidebar integrations
293#content .aui-sidebar ~ [class^="aui-"],
294#content .aui-sidebar + section,
295#content .aui-sidebar + main,
296#content + #footer {
297 .aui-page-sidebar & {
298 // needs to be padding, not margin, so that horizontal scrollbars are not drawn.
299 // future iterations of page layout should use grid or flexbox and carve out explicit space for sidebar.
300 padding-left: var(--aui-sidebar-width);
301 }
302
303 .aui-page-sidebar.aui-is-animated & {
304 #aui.transition(padding-left @aui-sidebar-default-transition-timing ease-in-out);
305 }
306}
307
308.aui-sidebar + .aui-page-panel {
309 border-top-width: 0;
310 margin-top: 0;
311}