forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_mixins.scss
56 lines (51 loc) · 1.49 KB
/
_mixins.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
//
// Copyright IBM Corp. 2018, 2023
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//
@use '../../config' as *;
/// Helper to add in text overflow styles to a particular node. Useful if we
/// don't want to have display-inline: block from the text helper classes
/// @access private
/// @group ui-shell
/// @example
/// .my-custom-selector {
/// @include text-overflow();
/// }
@mixin text-overflow {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/// Helper for handling selectors for the expansion state of the side-nav.
/// This helper makes it easier to write code for children that need to respond
/// to whether the side-nav is open, or closed. For convenience, we also
/// optionally set properties for opacity and visibility to help with the
/// transition animation.
/// @access private
/// @group ui-shell
/// @param {Bool} $opacity [false]
/// @param {Bool} $visibility [false]
/// @content
@mixin expanded($opacity: false, $visibility: false) {
@if $opacity == true {
opacity: 0;
}
@if $visibility == true {
visibility: hidden;
}
.#{$prefix}--side-nav:hover &,
// Include the fixed variant here so components can render in both expandable
// and fixed side navs
.#{$prefix}--side-nav--fixed &,
.#{$prefix}--side-nav--expanded & {
@if $visibility == true {
visibility: inherit;
}
@if $opacity == true {
opacity: 1;
}
@content;
}
}