Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Ctrl+M now opens/closes sidebar #605

Merged
merged 6 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion EssentialCSharp.Web/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@
<header class="header-background">
<div class="banner d-flex justify-content-between">
<div class="d-flex align-items-center menu-position">
<button class="menu-btn" v-on:click="sidebarShown = !sidebarShown">
<button class="menu-btn has-tooltip" v-on:click="sidebarShown = !sidebarShown">
<i class="fa fa-bars fa-lg icon-light"></i>
<span class="tooltip-text sidebar-tooltip-text">
<b>Ctrl + M</b>
</span>
</button>
<div class="d-none d-lg-block">
<ul class="nav align-items-center">
Expand Down
8 changes: 4 additions & 4 deletions EssentialCSharp.Web/Views/Shared/_LoginPartial.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
@inject SignInManager<EssentialCSharpWebUser> SignInManager
@inject UserManager<EssentialCSharpWebUser> UserManager

<div class="menu-tooltip text-nowrap">
<div class="has-tooltip text-nowrap">
@if (SignInManager.IsSignedIn(User))
{
<div class="menu-tooltip">
<div class="has-tooltip">
<a id="manage" class="nav-link text-light" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
</div>
<div class="menu-tooltip">
<div class="has-tooltip">
<form id="logoutForm" class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
<button id="logout" type="submit" class="nav-link btn btn-link text-light border-0">
<i class="fa fa-right-from-bracket icon-light"></i>
Expand All @@ -21,7 +21,7 @@
}
else
{
<div class="menu-tooltip">
<div class="has-tooltip">
<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>
</div>
}
Expand Down
36 changes: 32 additions & 4 deletions EssentialCSharp.Web/wwwroot/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ a:hover {
white-space: nowrap;
}

.menu-tooltip {
.has-tooltip {
position: relative;
display: inline-block;
}

.menu-tooltip .tooltip-text {
.has-tooltip .tooltip-text {
visibility: hidden;
width: 120px;
background-color: var(--grey-lighten-1);
Expand All @@ -250,11 +250,11 @@ a:hover {
z-index: 1;
}

.menu-tooltip:hover .tooltip-text {
.has-tooltip:hover .tooltip-text {
visibility: visible;
}

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

.has-tooltip:hover .sidebar-tooltip-text {
transition-delay: 1s;
transition-property: visibility;
}

.has-tooltip .sidebar-tooltip-text {
width: 90px;
position: relative;
left: 5rem;
border-radius: 10px;
padding: 10px;
white-space: normal;
}

.has-tooltip .sidebar-tooltip-text:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
border-width: 5px;
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-right: 8px solid var(--grey-lighten-1);
left: -9%;
bottom: 30%;
}

.nav-link {
color: white;
}
Expand Down
4 changes: 4 additions & 0 deletions EssentialCSharp.Web/wwwroot/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ const app = createApp({
goToPrevious();
}
}

if (e.code == "KeyM" && e.ctrlKey) {
BenjaminMichaelis marked this conversation as resolved.
Show resolved Hide resolved
sidebarShown.value = !sidebarShown.value;
}
});

const sidebarShown = ref(false);
Expand Down
Loading