Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

sidebar_ui: Fix positioning of unread dot on left sidebar toggle button.

harshbansal8705803988d20647
diff --git a/web/styles/zulip.css b/web/styles/zulip.css
index 7531f2db6cf..1adb7127c44 100644
--- a/web/styles/zulip.css
+++ b/web/styles/zulip.css
@@ -964,6 +964,7 @@ div.focused-message-list.is-conversation-view .recipient_row {
text-decoration: none;
color: var(--color-navbar-icon);
display: flex;
+ position: relative;
align-items: center;
justify-content: center;
width: var(--header-height);
@@ -1001,15 +1002,26 @@ div.focused-message-list.is-conversation-view .recipient_row {
.left-sidebar-toggle-unreadcount {
position: absolute;
display: none;
- height: 6px;
- width: 6px;
+ /* 6px at 16px/1em */
+ height: 0.375em;
+ width: 0.375em;
background-color: var(--color-navbar-icon);
- top: 10px;
- right: 9px;
- border: 2px solid var(--color-background-navbar);
- border-radius: 6px;
+
+ /* 2px at 16px/1em */
+ border: 0.125em solid var(--color-background-navbar);
+ /* 6px at 16px/1em */
+ border-radius: 0.375em;
padding: 0;
- font-size: 0;
+
+ /* At 16px/1em, the toggle icon is 20px on a side, which is
+ half the width of its container (40px on a side). To
+ place the 10px-wide unread counter correctly, then, we
+ set it to 25% of the right of the container, or 10px,
+ and likewise 25% down from the top of the container,
+ also 10px. */
+
+ top: 25%;
+ right: 25%;
}
nav {
@@ -1035,8 +1047,18 @@ nav {
}
.left-sidebar-toggle-button .left-sidebar-toggle-unreadcount {
- top: 10px;
- left: 21px;
+ /* The toggle icon is half the width of its container
+ and is at the center of the container.
+ So, the left width starts from left 25% of the container
+ and ends till 75% of the container's width.
+ Similarly, vertically, the dot is starts at the top 25% of
+ the container's height and ends at 75% of the total height
+
+ So, the top right corner of the icon is at 25% from top and
+ 75% from the right. This is the location where we place the
+ unread indicator dot. */
+ top: 25%;
+ right: 25%;
}
}
diff --git a/web/templates/navbar.hbs b/web/templates/navbar.hbs
index c6aedb05068..46ee6129212 100644
--- a/web/templates/navbar.hbs
+++ b/web/templates/navbar.hbs
@@ -4,7 +4,7 @@
<a class="header-button left-sidebar-toggle-button {{#if embedded}}hide-streamlist-toggle-visibility{{/if}}" tabindex="0" role="button">
<i class="zulip-icon zulip-icon-panel-left-dashed"></i>
<i class="zulip-icon zulip-icon-panel-left"></i>
- <span class="left-sidebar-toggle-unreadcount">0</span>
+ <span class="left-sidebar-toggle-unreadcount"></span>
</a>
<a href="" class="brand no-style">
<img id="realm-navbar-wide-logo" src="" alt="" class="nav-logo no-drag"/>
@@ -17,7 +17,7 @@
<a class="left-sidebar-toggle-button" role="button" tabindex="0">
<i class="zulip-icon zulip-icon-panel-left-dashed"></i>
<i class="zulip-icon zulip-icon-panel-left"></i>
- <span class="left-sidebar-toggle-unreadcount">0</span>
+ <span class="left-sidebar-toggle-unreadcount"></span>
</a>
</div>
<div class="top-navbar-container">