Skip to content

Commit 3746a62

Browse files
silverwindGiteaBot
andauthored
Tweak repo buttons on mobile and labeled button border-radius (#30503)
Fixes: #30514 Fixes: #30288 (comment) - Fix border-radius regression from #30475 - Fix and simplify hover state - Move the modal HTML so it does not interfere with the CSS - Make the star and unwatch text show on mobile. There is still plenty of space, below is iPhone 12 viewport size <img width="696" alt="Screenshot 2024-04-15 at 20 34 03" src="https://github.com/go-gitea/gitea/assets/115237/af90bb00-4671-4973-a255-8eb44ee6ba8d"> <img width="230" alt="Screenshot 2024-04-15 at 20 31 42" src="https://github.com/go-gitea/gitea/assets/115237/986ef533-7a01-4bb0-8dcd-fd19e4259e84"> <img width="233" alt="Screenshot 2024-04-15 at 20 31 47" src="https://github.com/go-gitea/gitea/assets/115237/5b825dd8-0ccc-4d56-9d8f-774abb935b68"> --------- Co-authored-by: Giteabot <teabot@gitea.io>
1 parent a658e2f commit 3746a62

File tree

6 files changed

+40
-26
lines changed

6 files changed

+40
-26
lines changed

templates/repo/header.tmpl

+18-18
Original file line numberDiff line numberDiff line change
@@ -91,28 +91,28 @@
9191
>
9292
{{svg "octicon-repo-forked"}}<span class="text not-mobile">{{ctx.Locale.Tr "repo.fork"}}</span>
9393
</a>
94-
<div class="ui small modal" id="fork-repo-modal">
95-
<div class="header">
96-
{{ctx.Locale.Tr "repo.already_forked" .Name}}
97-
</div>
98-
<div class="content tw-text-left">
99-
<div class="ui list">
100-
{{range $.UserAndOrgForks}}
101-
<div class="ui item tw-py-2">
102-
<a href="{{.Link}}">{{svg "octicon-repo-forked" 16 "tw-mr-2"}}{{.FullName}}</a>
103-
</div>
104-
{{end}}
105-
</div>
106-
{{if $.CanSignedUserFork}}
107-
<div class="divider"></div>
108-
<a href="{{$.RepoLink}}/fork">{{ctx.Locale.Tr "repo.fork_to_different_account"}}</a>
109-
{{end}}
110-
</div>
111-
</div>
11294
<a class="ui basic label" href="{{.Link}}/forks">
11395
{{CountFmt .NumForks}}
11496
</a>
11597
</div>
98+
<div class="ui small modal" id="fork-repo-modal">
99+
<div class="header">
100+
{{ctx.Locale.Tr "repo.already_forked" .Name}}
101+
</div>
102+
<div class="content tw-text-left">
103+
<div class="ui list">
104+
{{range $.UserAndOrgForks}}
105+
<div class="ui item tw-py-2">
106+
<a href="{{.Link}}">{{svg "octicon-repo-forked" 16 "tw-mr-2"}}{{.FullName}}</a>
107+
</div>
108+
{{end}}
109+
</div>
110+
{{if $.CanSignedUserFork}}
111+
<div class="divider"></div>
112+
<a href="{{$.RepoLink}}/fork">{{ctx.Locale.Tr "repo.fork_to_different_account"}}</a>
113+
{{end}}
114+
</div>
115+
</div>
116116
{{end}}
117117
</div>
118118
{{end}}

templates/repo/star_unstar.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{{if $.IsStaringRepo}}{{$buttonText = ctx.Locale.Tr "repo.unstar"}}{{end}}
55
<button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}">
66
{{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{else}}{{svg "octicon-star"}}{{end}}
7-
<span class="not-mobile" aria-hidden="true">{{$buttonText}}</span>
7+
<span aria-hidden="true">{{$buttonText}}</span>
88
</button>
99
<a hx-boost="false" class="ui basic label" href="{{$.RepoLink}}/stars">
1010
{{CountFmt .Repository.NumStars}}

templates/repo/watch_unwatch.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{{if $.IsWatchingRepo}}{{$buttonText = ctx.Locale.Tr "repo.unwatch"}}{{end}}
55
<button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}">
66
{{svg "octicon-eye"}}
7-
<span class="not-mobile" aria-hidden="true">{{$buttonText}}</span>
7+
<span aria-hidden="true">{{$buttonText}}</span>
88
</button>
99
<a hx-boost="false" class="ui basic label" href="{{.RepoLink}}/watchers">
1010
{{CountFmt .Repository.NumWatches}}

web_src/css/modules/button.css

+10
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,23 @@
6363
}
6464
.ui.labeled.button > .button {
6565
margin: 0;
66+
border-top-right-radius: 0;
67+
border-bottom-right-radius: 0;
6668
}
6769
.ui.labeled.button > .label {
6870
display: flex;
6971
align-items: center;
7072
margin: 0 0 0 -1px !important;
7173
font-size: 1em;
7274
border-color: var(--color-light-border);
75+
border-top-left-radius: 0;
76+
border-bottom-left-radius: 0;
77+
}
78+
.ui.labeled.button > .label:hover {
79+
background: var(--color-hover);
80+
}
81+
.ui.labeled.button > .button:hover + .label {
82+
border-left-color: var(--color-secondary-dark-2);
7383
}
7484

7585
.ui.button > .icon:not(.button) {

web_src/css/modules/label.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ a.ui.label:hover {
107107
a.ui.basic.label:hover {
108108
text-decoration: none;
109109
color: var(--color-text);
110-
border-color: var(--color-light-border);
110+
border-color: var(--color-secondary-dark-2);
111111
background: var(--color-hover);
112112
}
113113

web_src/css/repo/header.css

+9-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
gap: 0.25em;
3737
}
3838

39-
.repo-buttons .ui.labeled.button > .label:hover {
40-
color: var(--color-primary-light-2);
41-
background: var(--color-light);
42-
}
43-
4439
.repo-buttons button[disabled] ~ .label {
4540
opacity: var(--opacity-disabled);
4641
color: var(--color-text-dark);
@@ -67,3 +62,12 @@
6762
.repo-buttons .ui.labeled.button.disabled > .button {
6863
pointer-events: none !important;
6964
}
65+
66+
@media (max-width: 767.98px) {
67+
.repo-buttons .ui.button,
68+
.repo-buttons .ui.label {
69+
padding-left: 8px;
70+
padding-right: 8px;
71+
margin: 0;
72+
}
73+
}

0 commit comments

Comments
 (0)