File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 3
3
@inject GlobalConfig GlobalConfig ;
4
4
@implements IDisposable
5
5
6
- <MNavigationDrawer Class =" navigation" Width =300 MiniVariantWidth =80 Fixed ExpandOnHover =" GlobalConfig.ExpandOnHover" @bind-MiniVariant =" GlobalConfig.NavigationMini" App >
6
+ <MNavigationDrawer @bind-Value = " Visible " Class =" navigation" Width =300 MiniVariantWidth =80 Fixed ExpandOnHover =" GlobalConfig.ExpandOnHover" @bind-MiniVariant =" GlobalConfig.NavigationMini" App >
7
7
8
8
<div style =" height :132px " class =" @($" block-center {(GlobalConfig.NavigationMini? " px-4" : " px-12" )} " )" @onclick =" ()=>NavHelper.NavigateTo(GlobalVariables.DefaultRoute)" >
9
9
@if (GlobalConfig .NavigationMini )
72
72
73
73
</MNavigationDrawer >
74
74
75
- <MButton Small Fab Color =" primary" Style =" @($" bottom:58px;z-index:7;position: fixed;{(GlobalConfig.NavigationMini ? " left:60px; " : " left:280px; " )} " ) " OnClick =" ()=>{GlobalConfig.ExpandOnHover=!GlobalConfig.ExpandOnHover;} " >
75
+ <MButton Small Fab Color =" primary" Style =" @($" bottom:58px;z-index:7;position: fixed;left:{ButtonLeft}px; " ) " OnClick =Switch >
76
76
<MIcon Class =" white--text" >
77
- @( GlobalConfig .NavigationMini ? " mdi-chevron-right" : " mdi-chevron-left" )
77
+ @( GlobalConfig .NavigationMini ? " mdi-chevron-right" : " mdi-chevron-left" )
78
78
</MIcon >
79
79
</MButton >
80
80
81
81
@code {
82
+ public bool Visible { get ; set ; } = true ;
83
+
84
+ public int ButtonLeft => ! Visible ? - 14 : GlobalConfig .NavigationMini ? 60 : 280 ;
85
+
82
86
protected override void OnInitialized ()
83
87
{
84
88
GlobalConfig .OnLanguageChanged += base .StateHasChanged ;
85
89
}
86
90
91
+ public void Switch ()
92
+ {
93
+ if (Visible )
94
+ {
95
+ GlobalConfig .ExpandOnHover = ! GlobalConfig .ExpandOnHover ;
96
+ }
97
+ else Visible = true ;
98
+ }
99
+
87
100
public void Dispose ()
88
101
{
89
102
GlobalConfig .OnLanguageChanged -= base .StateHasChanged ;
You can’t perform that action at this time.
0 commit comments