Skip to content

Commit

Permalink
Refactored CSS for tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua-Lester3 committed Oct 11, 2024
1 parent 55afbb1 commit 0acade6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 28 deletions.
8 changes: 4 additions & 4 deletions EssentialCSharp.Web/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@
<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 sidebar-tooltip" 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="sidebar-tooltip-text">
<b>Ctrl + M</b>
<span class="tooltip-text sidebar-tooltip-text">
<b>Ctrl + M</b>
</span>
</button>
<div class="d-none d-lg-block">
Expand Down Expand Up @@ -305,7 +305,7 @@
<details :open="expandedTocs.has(item.key)"
v-on:toggle="!$event.target.open ? expandedTocs.delete(item.key) : expandedTocs.add(item.key)">
<summary :class="{
'toc-content' : item.level= =0,
'toc-content' : item.level==0,
'nested' : item.level>
0,
'current-section': currentPage.some(p => p.key == item.key),
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
45 changes: 25 additions & 20 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,27 +265,32 @@ a:hover {
border-color: transparent transparent var(--grey-lighten-1) transparent;
}

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

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

.sidebar-tooltip .sidebar-tooltip-text {
visibility: hidden;
position: absolute;
width: 80px;
color: var(--primary-color);
font-size: 1rem;
background-color: var(--grey-lighten-1);
.has-tooltip .sidebar-tooltip-text {
width: 90px;
position: relative;
left: 5rem;
border-radius: 10px;
padding: 10px;
white-space: normal;
left: 2rem;
bottom: -9px;
}

.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 {
Expand Down

0 comments on commit 0acade6

Please sign in to comment.