UNPKG

6.55 kBSCSSView Raw
1//
2// Copyright IBM Corp. 2016, 2018
3//
4// This source code is licensed under the Apache-2.0 license found in the
5// LICENSE file in the root directory of this source tree.
6//
7
8@import '../../globals/scss/functions';
9@import '../../globals/scss/helper-classes';
10@import '../../globals/scss/helper-mixins';
11@import '../../globals/scss/layout';
12@import '../../globals/scss/vars';
13@import '../../globals/scss/typography';
14@import 'theme';
15@import 'functions';
16
17@mixin carbon-header {
18 .#{$prefix}--header {
19 display: flex;
20 align-items: center;
21 position: fixed;
22 top: 0;
23 left: 0;
24 right: 0;
25 height: mini-units(6);
26 background-color: $shell-header-bg-01;
27 color: $shell-header-text-01;
28 z-index: z('header');
29 }
30
31 .#{$prefix}--header__action {
32 @include button-reset();
33 width: mini-units(6);
34 height: mini-units(6);
35 border: rem(3px) solid transparent;
36 }
37
38 .#{$prefix}--header__action > svg.#{$prefix}--navigation-menu-panel-collapse-icon,
39 .#{$prefix}--header__action--active > svg.#{$prefix}--navigation-menu-panel-expand-icon {
40 display: none;
41 }
42
43 .#{$prefix}--header__action--active > svg.#{$prefix}--navigation-menu-panel-collapse-icon {
44 display: inline;
45 }
46
47 .#{$prefix}--header__action > svg.#{$prefix}--navigation-menu-panel-collapse-icon,
48 .#{$prefix}--header__action--active > svg.#{$prefix}--navigation-menu-panel-expand-icon {
49 display: none;
50 }
51
52 .#{$prefix}--header__action--active > svg.#{$prefix}--navigation-menu-panel-collapse-icon {
53 display: inline;
54 }
55
56 .#{$prefix}--header__action:hover {
57 background-color: #333333;
58 }
59
60 .#{$prefix}--header__action--active,
61 .#{$prefix}--header__action--active:hover {
62 background-color: $shell-brand-01;
63 }
64
65 .#{$prefix}--header__action--active,
66 .#{$prefix}--header__action:focus {
67 border-color: $shell-brand-01;
68 outline: none;
69 }
70
71 .#{$prefix}--header__action > svg {
72 fill: $shell-header-icon-01;
73 }
74
75 //--------------------------------------------------------------------------
76 // Header - Name
77 //--------------------------------------------------------------------------
78 a.#{$prefix}--header__name {
79 @include type-style('body-short-01');
80 display: flex;
81 align-items: center;
82 height: 100%;
83 padding: 0 mini-units(2);
84 text-decoration: none;
85 font-weight: 600;
86 letter-spacing: 0.1px;
87 line-height: 20px;
88 user-select: none;
89 }
90
91 .#{$prefix}--header__name--prefix {
92 font-weight: 400;
93 }
94
95 a.#{$prefix}--header__name,
96 a.#{$prefix}--header__name:hover {
97 color: $shell-header-text-01;
98 }
99
100 a.#{$prefix}--header__name:focus {
101 outline: none;
102 box-shadow: inset 0 0 0 4px $shell-brand-01;
103 }
104
105 //--------------------------------------------------------------------------
106 // Header - Navigation
107 //--------------------------------------------------------------------------
108 .#{$prefix}--header__nav {
109 height: 100%;
110 }
111
112 .#{$prefix}--header__menu-bar[role='menubar'] {
113 display: flex;
114 margin-left: mini-units(1);
115 height: 100%;
116 }
117
118 a.#{$prefix}--header__menu-item[role='menuitem'] {
119 display: flex;
120 align-items: center;
121 color: $shell-header-text-01;
122 padding: 0 mini-units(2);
123 // Used for links that are directly in the menubar to span the full height
124 height: 100%;
125 // Text styles
126 font-size: rem(14px);
127 font-weight: 400;
128 letter-spacing: 0;
129 line-height: rem(18px);
130 // Reset link styles and make sure the text isn't selectable
131 text-decoration: none;
132 user-select: none;
133 // Used for focus styles
134 border: 4px solid transparent;
135 }
136
137 a.#{$prefix}--header__menu-item[role='menuitem']:hover {
138 background-color: #333333;
139 }
140
141 .#{$prefix}--header__action:active,
142 a.#{$prefix}--header__menu-item[role='menuitem']:active {
143 background-color: $ibm-color__gray-80;
144 }
145
146 a.#{$prefix}--header__menu-item[role='menuitem']:focus {
147 border-color: $ibm-color__blue-60;
148 outline: none;
149 }
150
151 .#{$prefix}--header__submenu {
152 position: relative;
153 }
154
155 .#{$prefix}--header__menu-title[role='menuitem'][aria-haspopup='true'] {
156 position: relative;
157 }
158
159 .#{$prefix}--header__menu-title[role='menuitem'][aria-expanded='true'] {
160 background-color: $ibm-color__gray-80;
161 // Note: needs to be higher than menu. Adding 1 here instead of moving to
162 // the next level.
163 z-index: #{z('header') + 1};
164 }
165
166 .#{$prefix}--header__menu-title[role='menuitem'][aria-expanded='true'] > .#{$prefix}--header__menu-arrow {
167 transform: rotate(180deg);
168 }
169
170 .#{$prefix}--header__menu[role='menu'] {
171 display: none;
172 }
173
174 .#{$prefix}--header__menu-title[role='menuitem'][aria-expanded='true'] + .#{$prefix}--header__menu {
175 position: absolute;
176 bottom: 0;
177 left: 0;
178 display: flex;
179 width: mini-units(25);
180 flex-direction: column;
181 transform: translateY(100%);
182 background-color: $ibm-color__gray-80;
183 box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.5);
184 z-index: z('header');
185 }
186
187 .#{$prefix}--header__menu .#{$prefix}--header__menu-item[role='menuitem'] {
188 height: mini-units(6);
189 }
190
191 .#{$prefix}--header__menu .#{$prefix}--header__menu-item[role='menuitem']:hover {
192 background-color: #4c4c4c;
193 color: #fff;
194 }
195
196 .#{$prefix}--header__menu-arrow {
197 fill: $ibm-color__gray-10;
198 margin-left: mini-units(1);
199 }
200
201 //--------------------------------------------------------------------------
202 // Header - Global
203 //--------------------------------------------------------------------------
204 .#{$prefix}--header__global {
205 display: flex;
206 justify-content: flex-end;
207 flex: 1 1 0%;
208 height: 100%;
209 }
210
211 //--------------------------------------------------------------------------
212 // Header - Skip to content
213 //--------------------------------------------------------------------------
214 .#{$prefix}--skip-to-content {
215 position: absolute;
216 width: 1px;
217 height: 1px;
218 padding: 0;
219 margin: -1px;
220 overflow: hidden;
221 clip: rect(0, 0, 0, 0);
222 border: 0;
223 visibility: visible;
224 white-space: nowrap;
225 }
226
227 .#{$prefix}--skip-to-content:focus {
228 display: flex;
229 align-items: center;
230 top: 0;
231 left: 0;
232 width: auto;
233 height: 3rem;
234 clip: auto;
235 border: 4px solid $ibm-color__blue-60;
236 z-index: 9999;
237 background-color: $shell-header-bg-01;
238 color: $shell-header-text-01;
239 outline: none;
240 padding: 0 1rem;
241 }
242}
243
244@include exports('carbon-header') {
245 @if feature-flag-enabled('ui-shell') {
246 @include carbon-header;
247 }
248}