Skip to content

Commit c41630a

Browse files
feat: Ctrl+M now opens/closes sidebar (#605)
## Description Added check for eventListener that opens/closes the sidebar if Ctrl+M are pressed. Fixes IntelliTect-dev/EssentialCSharp.Tooling#449
1 parent 36dacd0 commit c41630a

File tree

4 files changed

+44
-9
lines changed

4 files changed

+44
-9
lines changed

EssentialCSharp.Web/Views/Shared/_Layout.cshtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,11 @@
9494
<header class="header-background">
9595
<div class="banner d-flex justify-content-between">
9696
<div class="d-flex align-items-center menu-position">
97-
<button class="menu-btn" v-on:click="sidebarShown = !sidebarShown">
97+
<button class="menu-btn has-tooltip" v-on:click="sidebarShown = !sidebarShown">
9898
<i class="fa fa-bars fa-lg icon-light"></i>
99+
<span class="tooltip-text sidebar-tooltip-text">
100+
<b>Ctrl + M</b>
101+
</span>
99102
</button>
100103
<div class="d-none d-lg-block">
101104
<ul class="nav align-items-center">

EssentialCSharp.Web/Views/Shared/_LoginPartial.cshtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
@inject SignInManager<EssentialCSharpWebUser> SignInManager
55
@inject UserManager<EssentialCSharpWebUser> UserManager
66

7-
<div class="menu-tooltip text-nowrap">
7+
<div class="has-tooltip text-nowrap">
88
@if (SignInManager.IsSignedIn(User))
99
{
10-
<div class="menu-tooltip">
10+
<div class="has-tooltip">
1111
<a id="manage" class="nav-link text-light" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
1212
</div>
13-
<div class="menu-tooltip">
13+
<div class="has-tooltip">
1414
<form id="logoutForm" class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
1515
<button id="logout" type="submit" class="nav-link btn btn-link text-light border-0">
1616
<i class="fa fa-right-from-bracket icon-light"></i>
@@ -21,7 +21,7 @@
2121
}
2222
else
2323
{
24-
<div class="menu-tooltip">
24+
<div class="has-tooltip">
2525
<a class="nav-link text-light" id="login" asp-area="Identity" asp-page="/Account/Login"><i class="fa fa-right-to-bracket icon-light"></i> Login</a>
2626
</div>
2727
}

EssentialCSharp.Web/wwwroot/css/styles.css

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ a:hover {
228228
white-space: nowrap;
229229
}
230230

231-
.menu-tooltip {
231+
.has-tooltip {
232232
position: relative;
233233
display: inline-block;
234234
}
235235

236-
.menu-tooltip .tooltip-text {
236+
.has-tooltip .tooltip-text {
237237
visibility: hidden;
238238
width: 120px;
239239
background-color: var(--grey-lighten-1);
@@ -250,11 +250,11 @@ a:hover {
250250
z-index: 1;
251251
}
252252

253-
.menu-tooltip:hover .tooltip-text {
253+
.has-tooltip:hover .tooltip-text {
254254
visibility: visible;
255255
}
256256

257-
.menu-tooltip .tooltip-text::after {
257+
.has-tooltip .tooltip-text::after {
258258
content: " ";
259259
position: absolute;
260260
bottom: 100%; /* At the top of the tooltip */
@@ -265,6 +265,34 @@ a:hover {
265265
border-color: transparent transparent var(--grey-lighten-1) transparent;
266266
}
267267

268+
.has-tooltip:hover .sidebar-tooltip-text {
269+
transition-delay: 1s;
270+
transition-property: visibility;
271+
}
272+
273+
.has-tooltip .sidebar-tooltip-text {
274+
width: 90px;
275+
position: relative;
276+
left: 5rem;
277+
border-radius: 10px;
278+
padding: 10px;
279+
white-space: normal;
280+
}
281+
282+
.has-tooltip .sidebar-tooltip-text:after {
283+
content: '';
284+
display: block;
285+
width: 0;
286+
height: 0;
287+
position: absolute;
288+
border-width: 5px;
289+
border-top: 8px solid transparent;
290+
border-bottom: 8px solid transparent;
291+
border-right: 8px solid var(--grey-lighten-1);
292+
left: -9%;
293+
bottom: 30%;
294+
}
295+
268296
.nav-link {
269297
color: white;
270298
}

EssentialCSharp.Web/wwwroot/js/site.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ const app = createApp({
177177
goToPrevious();
178178
}
179179
}
180+
181+
if (e.code == "KeyM" && e.ctrlKey) {
182+
sidebarShown.value = !sidebarShown.value;
183+
}
180184
});
181185

182186
const sidebarShown = ref(false);

0 commit comments

Comments
 (0)