forked from canonical/vanilla-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_patterns_side-navigation-expandable.scss
More file actions
77 lines (68 loc) · 1.83 KB
/
_patterns_side-navigation-expandable.scss
File metadata and controls
77 lines (68 loc) · 1.83 KB
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
@import 'settings';
@mixin vf-p-side-navigation-expandable {
.p-side-navigation__item,
.p-side-navigation__item--title {
// position relative for the absolutely positioned `.p-side-navigation__expand` button
position: relative;
}
.p-side-navigation__link.is-expandable,
.p-side-navigation__text.is-expandable {
// extra padding to accomodate for `.p-side-navigation__expand` button
padding-right: 3rem;
}
.p-side-navigation__expand {
@include vf-button-base;
background: none;
background-color: inherit;
border: 0;
border-radius: 0;
font-size: inherit;
line-height: inherit;
margin: 0;
padding-bottom: $spv--x-small;
padding-top: $spv--x-small;
position: absolute;
right: 0;
top: 0;
&::before {
@extend %icon;
@include vf-icon-chevron-themed;
content: '';
transform: rotate(-90deg);
transition: transform 100ms;
}
&:hover {
background: $colors--theme--background-hover;
color: $colors--theme--text-default;
}
}
.p-side-navigation__expand[aria-expanded='true'] {
background-color: inherit;
&::before {
transform: rotate(0deg);
}
&:hover {
background: $colors--theme--background-hover;
color: $colors--theme--text-default;
}
}
// transition
.p-side-navigation__list {
@include vf-animation(#{transform, opacity}, fast);
}
.p-side-navigation__expand[aria-expanded='false'] + .p-side-navigation__list {
height: 0;
opacity: 0;
overflow: hidden;
transform: translate3d(0, -0.5rem, 0);
// disable transition on close
transition-duration: 0s;
visibility: hidden;
}
.p-side-navigation__expand[aria-expanded='true'] + .p-side-navigation__list {
height: auto;
opacity: 1;
transform: translate3d(0, 0, 0);
visibility: visible;
}
}