@@ -24,6 +24,7 @@ export interface MockAppSidebarAppSideNavSignature {
24
24
isResponsive? : HdsAppSideNavSignature [' Args' ][' isResponsive' ];
25
25
isCollapsible? : HdsAppSideNavSignature [' Args' ][' isCollapsible' ];
26
26
showDevToggle? : boolean ;
27
+ shouldRemoveFromDomOnCollapse? : boolean ;
27
28
};
28
29
Element: HdsAppSideNavSignature [' Element' ];
29
30
}
@@ -32,6 +33,7 @@ export default class MockAppSidebarAppSideNav extends Component<MockAppSidebarAp
32
33
isResponsive;
33
34
isCollapsible;
34
35
@tracked showMockInteractionState = false ;
36
+ @tracked isRendered = true ;
35
37
36
38
constructor (owner : Owner , args : MockAppSidebarAppSideNavSignature [' Args' ]) {
37
39
super (owner , args );
@@ -43,110 +45,118 @@ export default class MockAppSidebarAppSideNav extends Component<MockAppSidebarAp
43
45
this .showMockInteractionState = ! this .showMockInteractionState ;
44
46
};
45
47
48
+ removeSideNavFromDOM = (isOpen : boolean ) => {
49
+ if (isOpen && this .args .shouldRemoveFromDomOnCollapse )
50
+ this .isRendered = false ;
51
+ };
52
+
46
53
<template >
47
- <HdsAppSideNav
48
- @ isResponsive ={{this .isResponsive }}
49
- @ isCollapsible ={{this .isCollapsible }}
50
- >
51
- <HdsAppSideNavList
52
- class =" hds-side-nav-hide-when-minimized"
53
- aria-label =" Dashboard"
54
- as | SNL |
55
- >
56
- <SNL.Link @ icon =" dashboard" @ text =" Dashboard" @ isActive ={{ true }} />
57
- </HdsAppSideNavList >
58
- <HdsAppSideNavList
59
- class =" hds-side-nav-hide-when-minimized"
60
- aria-label =" Services"
61
- as | SNL |
62
- >
63
- <SNL.Title >Services</SNL.Title >
64
- <SNL.Link
65
- @ text ={{if this . showMockInteractionState " isActive" " Boundary" }}
66
- @ icon =" boundary"
67
- @ href =" #"
68
- class =" active"
69
- />
70
- <SNL.Link
71
- @ text ={{if this . showMockInteractionState " :focus" " Consul" }}
72
- @ icon =" consul"
73
- @ href =" #"
74
- class =" mock-focus"
75
- />
76
- <SNL.Link
77
- @ text ={{if this . showMockInteractionState " :hover" " Packer" }}
78
- @ icon =" packer"
79
- @ href =" #"
80
- class =" mock-hover"
81
- />
82
- <SNL.Link
83
- @ text ={{if this . showMockInteractionState " :active" " Vault" }}
84
- @ icon =" vault"
85
- @ href =" #"
86
- class =" mock-active"
87
- />
88
- <SNL.Link
89
- @ text =" Vault Secrets"
90
- @ icon =" vault-secrets-square"
91
- @ href =" #"
92
- />
93
- <SNL.Link @ text =" Terraform" @ icon =" terraform" @ href =" #" />
94
- <SNL.Link @ text =" Vagrant" @ icon =" vagrant" @ badge =" Alpha" @ href =" #" />
95
- <SNL.Link
96
- @ text =" Waypoint"
97
- @ icon =" waypoint"
98
- @ badge =" Alpha"
99
- @ hasSubItems ={{ true }}
100
- />
101
- </HdsAppSideNavList >
102
- <HdsAppSideNavList
103
- class =" hds-side-nav-hide-when-minimized"
104
- aria-label =" Organization"
105
- as | SNL |
54
+ {{#if this . isRendered }}
55
+ <HdsAppSideNav
56
+ @ isResponsive ={{this .isResponsive }}
57
+ @ isCollapsible ={{this .isCollapsible }}
58
+ @ onToggleMinimizedStatus ={{this .removeSideNavFromDOM }}
106
59
>
107
- <SNL.Title >Default Org</SNL.Title >
108
- <SNL.Link
109
- @ text =" HashiCorp Virtual Networks"
110
- @ icon =" network"
111
- @ href =" #"
112
- />
113
- <SNL.Link
114
- @ text =" Access control (IAM)"
115
- @ icon =" users"
116
- @ href =" #"
117
- @ hasSubItems ={{ true }}
118
- />
119
- <SNL.Link
120
- @ text =" Billing"
121
- @ icon =" credit-card"
122
- @ href =" #"
123
- @ hasSubItems ={{ true }}
124
- />
125
- <SNL.Link
126
- @ text =" Settings"
127
- @ icon =" settings"
128
- @ href =" #"
129
- @ hasSubItems ={{ true }}
130
- />
131
- <SNL.Link
132
- @ href =" #"
133
- @ isHrefExternal ={{ true }}
134
- @ icon =" guide"
135
- @ text =" Documentation"
136
- />
137
- {{#if @ showDevToggle }}
138
- <SNL.ExtraAfter >
139
- <div {{style margin =" 32px 6px" }} >
140
- <HdsFormToggleField
141
- {{on " change" this . toggleMockInteractionState}}
142
- as | F |
143
- >
144
- <F.Label >Show mock states</F.Label >
145
- </HdsFormToggleField >
146
- </div >
147
- </SNL.ExtraAfter >
148
- {{/if }}
149
- </HdsAppSideNavList >
150
- </HdsAppSideNav >
60
+ <HdsAppSideNavList
61
+ class =" hds-side-nav-hide-when-minimized"
62
+ aria-label =" Dashboard"
63
+ as | SNL |
64
+ >
65
+ <SNL.Link @ icon =" dashboard" @ text =" Dashboard" @ isActive ={{ true }} />
66
+ </HdsAppSideNavList >
67
+ <HdsAppSideNavList
68
+ class =" hds-side-nav-hide-when-minimized"
69
+ aria-label =" Services"
70
+ as | SNL |
71
+ >
72
+ <SNL.Title >Services</SNL.Title >
73
+ <SNL.Link
74
+ @ text ={{if this . showMockInteractionState " isActive" " Boundary" }}
75
+ @ icon =" boundary"
76
+ @ href =" #"
77
+ class =" active"
78
+ />
79
+ <SNL.Link
80
+ @ text ={{if this . showMockInteractionState " :focus" " Consul" }}
81
+ @ icon =" consul"
82
+ @ href =" #"
83
+ class =" mock-focus"
84
+ />
85
+ <SNL.Link
86
+ @ text ={{if this . showMockInteractionState " :hover" " Packer" }}
87
+ @ icon =" packer"
88
+ @ href =" #"
89
+ class =" mock-hover"
90
+ />
91
+ <SNL.Link
92
+ @ text ={{if this . showMockInteractionState " :active" " Vault" }}
93
+ @ icon =" vault"
94
+ @ href =" #"
95
+ class =" mock-active"
96
+ />
97
+ <SNL.Link
98
+ @ text =" Vault Secrets"
99
+ @ icon =" vault-secrets-square"
100
+ @ href =" #"
101
+ />
102
+ <SNL.Link @ text =" Terraform" @ icon =" terraform" @ href =" #" />
103
+ <SNL.Link @ text =" Vagrant" @ icon =" vagrant" @ badge =" Alpha" @ href =" #" />
104
+ <SNL.Link
105
+ @ text =" Waypoint"
106
+ @ icon =" waypoint"
107
+ @ badge =" Alpha"
108
+ @ hasSubItems ={{ true }}
109
+ />
110
+ </HdsAppSideNavList >
111
+ <HdsAppSideNavList
112
+ class =" hds-side-nav-hide-when-minimized"
113
+ aria-label =" Organization"
114
+ as | SNL |
115
+ >
116
+ <SNL.Title >Default Org</SNL.Title >
117
+ <SNL.Link
118
+ @ text =" HashiCorp Virtual Networks"
119
+ @ icon =" network"
120
+ @ href =" #"
121
+ />
122
+ <SNL.Link
123
+ @ text =" Access control (IAM)"
124
+ @ icon =" users"
125
+ @ href =" #"
126
+ @ hasSubItems ={{ true }}
127
+ />
128
+ <SNL.Link
129
+ @ text =" Billing"
130
+ @ icon =" credit-card"
131
+ @ href =" #"
132
+ @ hasSubItems ={{ true }}
133
+ />
134
+ <SNL.Link
135
+ @ text =" Settings"
136
+ @ icon =" settings"
137
+ @ href =" #"
138
+ @ hasSubItems ={{ true }}
139
+ />
140
+ <SNL.Link
141
+ @ href =" #"
142
+ @ isHrefExternal ={{ true }}
143
+ @ icon =" guide"
144
+ @ text =" Documentation"
145
+ />
146
+ {{#if @ showDevToggle }}
147
+ <SNL.ExtraAfter >
148
+ <div {{style margin =" 32px 6px" }} >
149
+ <HdsFormToggleField
150
+ {{on " change" this . toggleMockInteractionState}}
151
+ as | F |
152
+ >
153
+ <F.Label >Show mock states</F.Label >
154
+ </HdsFormToggleField >
155
+ </div >
156
+ </SNL.ExtraAfter >
157
+ {{/if }}
158
+ </HdsAppSideNavList >
159
+ </HdsAppSideNav >
160
+ {{/if }}
151
161
</template >
152
162
}
0 commit comments