Skip to content

Commit b6bcb79

Browse files
authored
Improve notification icon and navbar (#25111)
Improvements to the notification icon and `<nav>`: - Add a opaque color for header hover and use it, allowing the border to be the right color on hover (sadly, not otherwise possible with CSS, not even `color-mix`). - Increase font size by 1px - Use flexbox for slightly better text centering - Reduce padding of user and add repo button, add margin on right side of user menu - Remove the `following bar` wrapper on navbar <img width="176" alt="Screenshot 2023-06-07 at 00 07 08" src="https://github.com/go-gitea/gitea/assets/115237/23cdc3d6-7f63-49df-bec3-f2e75e32a304"> <img width="63" alt="Screenshot 2023-06-07 at 00 07 14" src="https://github.com/go-gitea/gitea/assets/115237/fae602c2-4467-4d50-b1ec-56317843f9a2"> <img width="84" alt="Screenshot 2023-06-07 at 00 07 36" src="https://github.com/go-gitea/gitea/assets/115237/c48141b8-0b3c-48cc-846a-3a272524dbdb"> <img width="329" alt="Screenshot 2023-06-07 at 00 25 10" src="https://github.com/go-gitea/gitea/assets/115237/cda612f1-426e-466b-a351-fc992bfd18fd"> <img width="186" alt="Screenshot 2023-06-07 at 00 35 45" src="https://github.com/go-gitea/gitea/assets/115237/04484a2e-9bbf-493c-aa26-8e936da008fa"> <img width="797" alt="Screenshot 2023-06-07 at 16 57 40" src="https://github.com/go-gitea/gitea/assets/115237/e7ccb672-5807-4cb6-b306-b18ae0c7e321">
1 parent eac1bdd commit b6bcb79

File tree

7 files changed

+51
-44
lines changed

7 files changed

+51
-44
lines changed

templates/base/head.tmpl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@
7373
{{template "custom/body_inner_pre" .}}
7474

7575
{{if not .PageIsInstall}}
76-
<div class="ui top secondary stackable main menu following bar light">
77-
{{template "base/head_navbar" .}}
78-
</div><!-- end bar -->
76+
{{template "base/head_navbar" .}}
7977
{{end}}
8078

8179
{{if false}}

templates/base/head_navbar.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<nav class="ui container" id="navbar" aria-label="{{.locale.Tr "aria.navbar"}}">
1+
<nav class="ui container secondary stackable main menu" id="navbar" aria-label="{{.locale.Tr "aria.navbar"}}">
22
{{$notificationUnreadCount := 0}}
33
{{if .IsSigned}}
44
{{if .NotificationUnreadCount}}{{$notificationUnreadCount = call .NotificationUnreadCount}}{{end}}
@@ -78,7 +78,7 @@
7878
</div><!-- end dropdown avatar menu -->
7979
</div>
8080
{{else if .IsSigned}}
81-
<div class="right stackable menu">
81+
<div class="right stackable menu gt-mr-4">
8282
{{if EnableTimetracking}}
8383
<a class="active-stopwatch-trigger item ui gt-mx-0{{if not .ActiveStopwatch}} gt-hidden{{end}}" href="{{.ActiveStopwatch.IssueLink}}">
8484
<span class="fitted gt-relative">
@@ -125,7 +125,7 @@
125125
</span>
126126
</a>
127127

128-
<div class="ui dropdown jump item gt-mx-0" data-tooltip-content="{{.locale.Tr "create_new"}}">
128+
<div class="ui dropdown jump item gt-mx-0 gt-pr-3" data-tooltip-content="{{.locale.Tr "create_new"}}">
129129
<span class="text">
130130
<span class="fitted">{{svg "octicon-plus"}}</span>
131131
<span class="sr-mobile-only">{{.locale.Tr "create_new"}}</span>
@@ -148,7 +148,7 @@
148148
</div><!-- end content create new menu -->
149149
</div><!-- end dropdown menu create new -->
150150

151-
<div class="ui dropdown jump item gt-mx-0" data-tooltip-content="{{.locale.Tr "user_profile_and_more"}}">
151+
<div class="ui dropdown jump item gt-mx-0 gt-pr-3" data-tooltip-content="{{.locale.Tr "user_profile_and_more"}}">
152152
<span class="text">
153153
{{avatar $.Context .SignedUser 24 "tiny"}}
154154
<span class="sr-only">{{.locale.Tr "user_profile_and_more"}}</span>

templates/status/500.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</head>
1616
<body>
1717
<div class="full height">
18-
<nav class="ui secondary menu following bar light">
18+
<nav class="ui container secondary stackable main menu" id="navbar">
1919
<div class="ui container gt-df">
2020
<div class="item brand gt-f1">
2121
<a href="{{AppSubUrl}}/" aria-label="{{.locale.Tr "home"}}">

web_src/css/base.css

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@
195195
--color-input-toggle-background: #dedede;
196196
--color-input-border: #dedede;
197197
--color-input-border-hover: #cecece;
198-
--color-navbar: #f8f8f8;
199-
--color-navbar-transparent: #f8f8f800;
198+
--color-header-wrapper: #f8f8f8;
199+
--color-header-wrapper-transparent: #f8f8f800;
200200
--color-light: #00000006;
201201
--color-light-mimic-enabled: rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled)));
202202
--color-light-border: #0000001d;
@@ -223,7 +223,8 @@
223223
--color-reaction-active-bg: var(--color-primary-light-6);
224224
--color-tooltip-text: #ffffff;
225225
--color-tooltip-bg: #000000f0;
226-
--color-header-bar: #ffffff;
226+
--color-nav-bg: #ffffff;
227+
--color-nav-hover-bg: #ebebeb;
227228
--color-label-text: #232323;
228229
--color-label-bg: #cacaca5b;
229230
--color-label-hover-bg: #cacacaa0;
@@ -946,44 +947,44 @@ img.ui.avatar,
946947
}
947948
}
948949

949-
.following.bar {
950-
margin: 0 !important;
951-
}
952-
953-
.following.bar.light {
954-
background: var(--color-header-bar);
950+
#navbar {
951+
display: flex;
952+
align-items: center;
953+
background: var(--color-nav-bg);
955954
border-bottom: 1px solid var(--color-secondary);
955+
width: 100vw;
956+
min-height: 52px;
957+
margin: 0 !important;
956958
}
957959

958-
.following.bar .column .menu {
960+
#navbar .column .menu {
959961
margin-top: 0;
960962
}
961963

962-
.following.bar .fitted .svg {
964+
#navbar .fitted .svg {
963965
margin-right: 0;
964966
vertical-align: middle;
965967
}
966968

967-
.following.bar .searchbox {
969+
#navbar .searchbox {
968970
background-color: var(--color-input-background) !important;
969971
}
970972

971-
.following.bar .text .svg {
973+
#navbar .text .svg {
972974
width: 16px;
973975
text-align: center;
974976
}
975977

976-
.following.bar #navbar {
977-
width: 100vw;
978-
min-height: 52px;
978+
#navbar a.item:hover {
979+
background: var(--color-nav-hover-bg);
979980
}
980981

981-
.following.bar #navbar .dropdown .avatar {
982+
#navbar .dropdown .avatar {
982983
margin-right: 0 !important;
983984
}
984985

985986
@media (max-width: 767px) {
986-
.following.bar #navbar:not(.shown) > *:not(:first-child) {
987+
#navbar:not(.shown) > *:not(:first-child) {
987988
display: none;
988989
}
989990
}
@@ -1576,7 +1577,7 @@ img.ui.avatar,
15761577

15771578
.ui.menu.new-menu {
15781579
margin-bottom: 15px;
1579-
background: var(--color-navbar);
1580+
background: var(--color-header-wrapper);
15801581
border-bottom: 1px solid var(--color-secondary) !important;
15811582
overflow: auto;
15821583
}
@@ -1591,7 +1592,7 @@ img.ui.avatar,
15911592
.ui.menu.new-menu::after {
15921593
position: absolute;
15931594
display: block;
1594-
background: linear-gradient(to right, var(--color-navbar-transparent), var(--color-navbar) 100%);
1595+
background: linear-gradient(to right, var(--color-header-wrapper-transparent), var(--color-header-wrapper) 100%);
15951596
content: '';
15961597
right: 0;
15971598
height: 39px;
@@ -2126,24 +2127,31 @@ a.ui.basic.label:hover {
21262127
width: 13px;
21272128
height: 13px;
21282129
background: var(--color-primary);
2129-
border: 2px solid var(--color-header-bar);
2130+
border: 2px solid var(--color-nav-bg);
21302131
border-radius: 100%;
21312132
}
21322133

21332134
.notification_count {
2135+
display: flex;
2136+
align-items: center;
2137+
justify-content: center;
21342138
position: absolute;
2135-
left: 7px;
2136-
top: -9px;
2137-
min-width: 1.5em;
2138-
text-align: center;
2139+
left: 6px;
2140+
top: -8px;
2141+
min-width: 17px;
2142+
min-height: 17px;
21392143
background: var(--color-primary);
2140-
border: 2px solid var(--color-header-bar);
2141-
color: var(--color-header-bar);
2142-
padding: 2.75px;
2143-
border-radius: 1em;
2144-
font-size: 11px;
2144+
border: 2px solid var(--color-nav-bg);
2145+
color: var(--color-nav-bg);
2146+
border-radius: 17px;
2147+
padding: 0 3.5px;
2148+
font-size: 12px;
2149+
line-height: 12px;
21452150
font-weight: var(--font-weight-bold);
2146-
line-height: .7;
2151+
}
2152+
2153+
#navbar a.item:hover .notification_count {
2154+
border-color: var(--color-nav-hover-bg);
21472155
}
21482156

21492157
.rss-icon {

web_src/css/explore.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.explore .navbar {
22
margin-bottom: 15px !important;
3-
background-color: var(--color-navbar) !important;
3+
background-color: var(--color-header-wrapper) !important;
44
border-width: 1px !important;
55
}
66

web_src/css/repo.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
}
133133

134134
.repository .header-wrapper {
135-
background-color: var(--color-navbar);
135+
background-color: var(--color-header-wrapper);
136136
}
137137

138138
.repository .header-wrapper .ui.tabs.divider {

web_src/css/themes/theme-arc-green.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@
180180
--color-input-toggle-background: #454a57;
181181
--color-input-border: #454a57;
182182
--color-input-border-hover: #505667;
183-
--color-navbar: #2a2e3a;
184-
--color-navbar-transparent: #2a2e3a00;
183+
--color-header-wrapper: #2a2e3a;
184+
--color-header-wrapper-transparent: #2a2e3a00;
185185
--color-light: #00000028;
186186
--color-light-mimic-enabled: rgba(0, 0, 0, calc(40 / 255 * 222 / 255 / var(--opacity-disabled)));
187187
--color-light-border: #ffffff28;
@@ -207,7 +207,8 @@
207207
--color-reaction-active-bg: var(--color-primary-light-5);
208208
--color-tooltip-text: #ffffff;
209209
--color-tooltip-bg: #000000f0;
210-
--color-header-bar: #2e323e;
210+
--color-nav-bg: #2e323e;
211+
--color-nav-hover-bg: #434651;
211212
--color-label-text: #dfe3ec;
212213
--color-label-bg: #7c84974b;
213214
--color-label-hover-bg: #7c8497a0;

0 commit comments

Comments
 (0)