Skip to content

Commit 90cf07a

Browse files
silverwindlunny
andauthored
Improve notification and stopwatch styles (go-gitea#22169)
- Add dot-style indicators to notification and time tracker - Slightly reduce whitespace between right-aligned icons - Move notification icon to right on mobile - Switch menu icon to SVG <img width="270" alt="Screenshot 2022-12-19 at 19 40 32" src="https://user-images.githubusercontent.com/115237/208496795-ce8734a0-f109-47b7-8eb8-96931e867b23.png"> <img width="607" alt="Screenshot 2022-12-19 at 19 41 04" src="https://user-images.githubusercontent.com/115237/208496797-2ff68197-f520-4174-927e-ead15addd63e.png"> --------- Co-authored-by: Lunny Xiao <[email protected]>
1 parent 87261f3 commit 90cf07a

File tree

3 files changed

+53
-24
lines changed

3 files changed

+53
-24
lines changed

templates/base/head_navbar.tmpl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@
33
{{if .IsSigned}}
44
{{if .NotificationUnreadCount}}{{$notificationUnreadCount = call .NotificationUnreadCount}}{{end}}
55
{{end}}
6-
<div class="item brand" style="justify-content: space-between;">
6+
<div class="item brand sb">
77
<a href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}">
88
<img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}" aria-hidden="true">
99
</a>
10-
{{if .IsSigned}}
11-
<a href="{{AppSubUrl}}/notifications" class="tooltip mobile-only" data-content='{{.locale.Tr "notifications"}}'>
12-
<span class="text black">
13-
<span class="fitted">{{svg "octicon-bell"}}</span>
14-
<span class="ui red label mini{{if not $notificationUnreadCount}} hidden{{end}} notification_count">
15-
{{$notificationUnreadCount}}
10+
<div class="df ac">
11+
{{if .IsSigned}}
12+
<a href="{{AppSubUrl}}/notifications" class="tooltip mobile-only mr-4 mt-3" data-content="{{.locale.Tr "notifications"}}" aria-label="{{.locale.Tr "notifications"}}">
13+
<span class="fitted item">
14+
{{svg "octicon-bell"}}
15+
<span class="notification_count{{if not $notificationUnreadCount}} hidden{{end}}">
16+
{{$notificationUnreadCount}}
17+
</span>
1618
</span>
17-
</span>
18-
</a>
19-
{{end}}
20-
<div class="ui basic icon button mobile-only" id="navbar-expand-toggle">
21-
<i class="sidebar icon"></i>
19+
</a>
20+
{{end}}
21+
<div class="ui icon button mobile-only" id="navbar-expand-toggle">
22+
{{svg "octicon-three-bars"}}
23+
</div>
2224
</div>
2325
</div>
2426

@@ -78,12 +80,10 @@
7880
{{else if .IsSigned}}
7981
<div class="right stackable menu">
8082
{{if EnableTimetracking}}
81-
<a class="active-stopwatch-trigger item ui label {{if not .ActiveStopwatch}}hidden{{end}}" href="{{.ActiveStopwatch.IssueLink}}">
82-
<span class="text">
83-
<span class="fitted item">
84-
{{svg "octicon-stopwatch"}}
85-
<span class="red" style="position:absolute; right:-0.6em; top:-0.6em;">{{svg "octicon-dot-fill"}}</span>
86-
</span>
83+
<a class="active-stopwatch-trigger item ui mx-0{{if not .ActiveStopwatch}} hidden{{end}}" href="{{.ActiveStopwatch.IssueLink}}">
84+
<span class="fitted relative">
85+
{{svg "octicon-stopwatch"}}
86+
<span class="header-stopwatch-dot"></span>
8787
<span class="sr-mobile-only">{{.locale.Tr "active_stopwatch"}}</span>
8888
</span>
8989
</a>
@@ -118,16 +118,16 @@
118118
</div>
119119
{{end}}
120120

121-
<a href="{{AppSubUrl}}/notifications" class="item tooltip not-mobile" data-content="{{.locale.Tr "notifications"}}" aria-label="{{.locale.Tr "notifications"}}">
122-
<span class="text">
123-
<span class="fitted">{{svg "octicon-bell"}}</span>
124-
<span class="ui red label {{if not $notificationUnreadCount}}hidden{{end}} notification_count">
121+
<a href="{{AppSubUrl}}/notifications" class="item tooltip not-mobile mx-0" data-content="{{.locale.Tr "notifications"}}" aria-label="{{.locale.Tr "notifications"}}">
122+
<span class="fitted item">
123+
{{svg "octicon-bell"}}
124+
<span class="notification_count{{if not $notificationUnreadCount}} hidden{{end}}">
125125
{{$notificationUnreadCount}}
126126
</span>
127127
</span>
128128
</a>
129129

130-
<div class="ui dropdown jump item tooltip" data-content="{{.locale.Tr "create_new"}}">
130+
<div class="ui dropdown jump item tooltip mx-0" data-content="{{.locale.Tr "create_new"}}">
131131
<span class="text">
132132
<span class="fitted">{{svg "octicon-plus"}}</span>
133133
<span class="sr-mobile-only">{{.locale.Tr "create_new"}}</span>
@@ -150,7 +150,7 @@
150150
</div><!-- end content create new menu -->
151151
</div><!-- end dropdown menu create new -->
152152

153-
<div class="ui dropdown jump item tooltip" tabindex="-1" data-content="{{.locale.Tr "user_profile_and_more"}}">
153+
<div class="ui dropdown jump item tooltip mx-0" tabindex="-1" data-content="{{.locale.Tr "user_profile_and_more"}}">
154154
<span class="text">
155155
{{avatar .SignedUser 24 "tiny"}}
156156
<span class="sr-only">{{.locale.Tr "user_profile_and_more"}}</span>

web_src/less/_base.less

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@ a.ui.card:hover,
13641364
visibility: hidden;
13651365
}
13661366

1367+
.text.primary { color: var(--color-primary) !important; }
13671368
.text.red { color: var(--color-red) !important; }
13681369
.text.orange { color: var(--color-orange) !important; }
13691370
.text.yellow { color: var(--color-yellow) !important; }
@@ -2434,6 +2435,33 @@ a.ui.basic.label:hover {
24342435
margin-top: 1rem;
24352436
}
24362437

2438+
.header-stopwatch-dot {
2439+
position: absolute;
2440+
left: 8px;
2441+
top: -8px;
2442+
width: 13px;
2443+
height: 13px;
2444+
background: var(--color-primary);
2445+
border: 2px solid var(--color-header-bar);
2446+
border-radius: 100%;
2447+
}
2448+
2449+
.notification_count {
2450+
position: absolute;
2451+
left: 5px;
2452+
top: -8px;
2453+
min-width: 1.5em;
2454+
text-align: center;
2455+
background: var(--color-primary);
2456+
border: 2px solid var(--color-header-bar);
2457+
color: var(--color-header-bar);
2458+
padding: 2px;
2459+
border-radius: 1em;
2460+
font-size: 10px;
2461+
font-weight: 700;
2462+
line-height: .7;
2463+
}
2464+
24372465
table th[data-sortt-asc],
24382466
table th[data-sortt-desc] {
24392467
&:hover {

web_src/less/helpers.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
/* below class names match Tailwind CSS */
2323
.pointer-events-none { pointer-events: none !important; }
24+
.relative { position: relative !important; }
2425

2526
.mono {
2627
font-family: var(--fonts-monospace) !important;

0 commit comments

Comments
 (0)