Skip to content

Commit 6af34c0

Browse files
authored
Use mask-based fade-out effect for .new-menu (#27181)
The `.new-menu` was using a pseudo-element based fade-out effect. Replace this with a more modern mask-based effect which in this case required a child element to avoid fading out the background as well, so I applied it to child `new-menu-inner` which was present on all these menus except explore where I added it. There is no visual difference except that the items on the explore page have no `gap` between them any longer, making it consistent with other menus. Before and after: <img width="221" alt="Screenshot 2023-09-21 at 21 13 19" src="https://github.com/go-gitea/gitea/assets/115237/b4a38ce2-cee1-4c54-84a5-e1d0bfd79e29"> <img width="222" alt="Screenshot 2023-09-21 at 21 32 36" src="https://github.com/go-gitea/gitea/assets/115237/bb6b1335-d935-4ad4-bb85-3b0fc3027c2b"> Also, this cleans up the related CSS vars: - `--color-header-wrapper-transparent` is removed, no longer needed - `--color-header-wrapper` is defined in base theme as well, was previously unset and therefor transparent. [no whitespace diff](https://github.com/go-gitea/gitea/pull/27181/files?diff=unified&w=1) [demo of mask fade](https://jsfiddle.net/silverwind/tsfadb3u/)
1 parent c2eed61 commit 6af34c0

File tree

3 files changed

+21
-32
lines changed

3 files changed

+21
-32
lines changed

templates/explore/navbar.tmpl

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<div class="ui secondary pointing tabular top attached borderless menu new-menu navbar">
2-
<a class="{{if .PageIsExploreRepositories}}active {{end}}item" href="{{AppSubUrl}}/explore/repos">
3-
{{svg "octicon-repo"}} {{.locale.Tr "explore.repos"}}
4-
</a>
5-
{{if not .UsersIsDisabled}}
6-
<a class="{{if .PageIsExploreUsers}}active {{end}}item" href="{{AppSubUrl}}/explore/users">
7-
{{svg "octicon-person"}} {{.locale.Tr "explore.users"}}
2+
<div class="new-menu-inner">
3+
<a class="{{if .PageIsExploreRepositories}}active {{end}}item" href="{{AppSubUrl}}/explore/repos">
4+
{{svg "octicon-repo"}} {{.locale.Tr "explore.repos"}}
85
</a>
9-
{{end}}
10-
<a class="{{if .PageIsExploreOrganizations}}active {{end}}item" href="{{AppSubUrl}}/explore/organizations">
11-
{{svg "octicon-organization"}} {{.locale.Tr "explore.organizations"}}
12-
</a>
13-
{{if and (not $.UnitTypeCode.UnitGlobalDisabled) .IsRepoIndexerEnabled}}
14-
<a class="{{if .PageIsExploreCode}}active {{end}}item" href="{{AppSubUrl}}/explore/code">
15-
{{svg "octicon-code"}} {{.locale.Tr "explore.code"}}
16-
</a>
17-
{{end}}
6+
{{if not .UsersIsDisabled}}
7+
<a class="{{if .PageIsExploreUsers}}active {{end}}item" href="{{AppSubUrl}}/explore/users">
8+
{{svg "octicon-person"}} {{.locale.Tr "explore.users"}}
9+
</a>
10+
{{end}}
11+
<a class="{{if .PageIsExploreOrganizations}}active {{end}}item" href="{{AppSubUrl}}/explore/organizations">
12+
{{svg "octicon-organization"}} {{.locale.Tr "explore.organizations"}}
13+
</a>
14+
{{if and (not $.UnitTypeCode.UnitGlobalDisabled) .IsRepoIndexerEnabled}}
15+
<a class="{{if .PageIsExploreCode}}active {{end}}item" href="{{AppSubUrl}}/explore/code">
16+
{{svg "octicon-code"}} {{.locale.Tr "explore.code"}}
17+
</a>
18+
{{end}}
19+
</div>
1820
</div>

web_src/css/base.css

+4-16
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@
217217
--color-input-toggle-background: #dedede;
218218
--color-input-border: var(--color-secondary);
219219
--color-input-border-hover: var(--color-secondary-dark-1);
220+
--color-header-wrapper: transparent;
220221
--color-light: #00000006;
221222
--color-light-mimic-enabled: rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled)));
222223
--color-light-border: #0000001d;
@@ -1542,22 +1543,9 @@ img.ui.avatar,
15421543
margin-left: auto;
15431544
margin-right: auto;
15441545
overflow-x: auto;
1545-
}
1546-
1547-
.ui.menu.new-menu::after {
1548-
position: absolute;
1549-
display: block;
1550-
background: linear-gradient(to right, var(--color-header-wrapper-transparent), var(--color-header-wrapper) 100%);
1551-
content: "";
1552-
right: 0;
1553-
height: 39px;
1554-
width: 60px;
1555-
visibility: visible;
1556-
pointer-events: none;
1557-
}
1558-
1559-
.ui.menu.new-menu.shadow-body::after {
1560-
background: linear-gradient(to right, transparent, var(--color-body) 100%);
1546+
width: 100%;
1547+
mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 60px), transparent 100%);
1548+
-webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 60px), transparent 100%);
15611549
}
15621550

15631551
.ui.menu.new-menu .item {

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

-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@
198198
--color-input-border: var(--color-secondary);
199199
--color-input-border-hover: var(--color-secondary-dark-1);
200200
--color-header-wrapper: #202430;
201-
--color-header-wrapper-transparent: #20243000;
202201
--color-light: #00000028;
203202
--color-light-mimic-enabled: rgba(0, 0, 0, calc(40 / 255 * 222 / 255 / var(--opacity-disabled)));
204203
--color-light-border: #ffffff28;

0 commit comments

Comments
 (0)