Skip to content

Commit 1b1c55f

Browse files
silverwindGiteaBot
andauthored
Increase auth provider icon size on login page (#27122)
Before, 20px: <img width="474" alt="Screenshot 2023-09-19 at 00 10 05" src="https://github.com/go-gitea/gitea/assets/115237/4bed4edb-219d-4844-9d3c-0d747033b09f"> After, 28px: <img width="576" alt="Screenshot 2023-09-19 at 00 20 40" src="https://github.com/go-gitea/gitea/assets/115237/f482ac09-38ae-4c84-80d9-0bd39b7f9772"> Dropdown in account settings is unchanged at 20px: <img width="157" alt="Screenshot 2023-09-19 at 00 09 11" src="https://github.com/go-gitea/gitea/assets/115237/9c998cdf-eeed-4118-9262-664faaa56092"> --------- Co-authored-by: Giteabot <[email protected]>
1 parent fc09c30 commit 1b1c55f

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

services/auth/source/oauth2/providers.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
type Provider interface {
2323
Name() string
2424
DisplayName() string
25-
IconHTML() template.HTML
25+
IconHTML(size int) template.HTML
2626
CustomURLSettings() *CustomURLSettings
2727
}
2828

@@ -54,14 +54,16 @@ func (p *AuthSourceProvider) DisplayName() string {
5454
return p.sourceName
5555
}
5656

57-
func (p *AuthSourceProvider) IconHTML() template.HTML {
57+
func (p *AuthSourceProvider) IconHTML(size int) template.HTML {
5858
if p.iconURL != "" {
59-
img := fmt.Sprintf(`<img class="gt-object-contain gt-mr-3" width="20" height="20" src="%s" alt="%s">`,
59+
img := fmt.Sprintf(`<img class="gt-object-contain gt-mr-3" width="%d" height="%d" src="%s" alt="%s">`,
60+
size,
61+
size,
6062
html.EscapeString(p.iconURL), html.EscapeString(p.DisplayName()),
6163
)
6264
return template.HTML(img)
6365
}
64-
return p.GothProvider.IconHTML()
66+
return p.GothProvider.IconHTML(size)
6567
}
6668

6769
// Providers contains the map of registered OAuth2 providers in Gitea (based on goth)

services/auth/source/oauth2/providers_base.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ func (b *BaseProvider) DisplayName() string {
2727
}
2828

2929
// IconHTML returns icon HTML for this provider
30-
func (b *BaseProvider) IconHTML() template.HTML {
30+
func (b *BaseProvider) IconHTML(size int) template.HTML {
3131
svgName := "gitea-" + b.name
3232
switch b.name {
3333
case "gplus":
3434
svgName = "gitea-google"
3535
case "github":
3636
svgName = "octicon-mark-github"
3737
}
38-
svgHTML := svg.RenderHTML(svgName, 20, "gt-mr-3")
38+
svgHTML := svg.RenderHTML(svgName, size, "gt-mr-3")
3939
if svgHTML == "" {
4040
log.Error("No SVG icon for oauth2 provider %q", b.name)
41-
svgHTML = svg.RenderHTML("gitea-openid", 20, "gt-mr-3")
41+
svgHTML = svg.RenderHTML("gitea-openid", size, "gt-mr-3")
4242
}
4343
return svgHTML
4444
}

services/auth/source/oauth2/providers_openid.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func (o *OpenIDProvider) DisplayName() string {
2828
}
2929

3030
// IconHTML returns icon HTML for this provider
31-
func (o *OpenIDProvider) IconHTML() template.HTML {
32-
return svg.RenderHTML("gitea-openid", 20, "gt-mr-3")
31+
func (o *OpenIDProvider) IconHTML(size int) template.HTML {
32+
return svg.RenderHTML("gitea-openid", size, "gt-mr-3")
3333
}
3434

3535
// CreateGothProvider creates a GothProvider from this Provider

templates/user/auth/signin_inner.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
{{range $key := .OrderedOAuth2Names}}
6363
{{$provider := index $.OAuth2Providers $key}}
6464
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
65-
{{$provider.IconHTML}}
65+
{{$provider.IconHTML 28}}
6666
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
6767
</a>
6868
{{end}}

templates/user/auth/signup_inner.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
{{range $key := .OrderedOAuth2Names}}
6767
{{$provider := index $.OAuth2Providers $key}}
6868
<a class="{{$provider.Name}} ui button gt-df gt-ac gt-jc gt-py-3 oauth-login-link" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
69-
{{$provider.IconHTML}}
69+
{{$provider.IconHTML 28}}
7070
{{$.locale.Tr "sign_in_with_provider" $provider.DisplayName}}
7171
</a>
7272
{{end}}

templates/user/settings/security/accountlinks.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{range $key := .OrderedOAuth2Names}}
1111
{{$provider := index $.OAuth2Providers $key}}
1212
<a class="item" href="{{AppSubUrl}}/user/oauth2/{{$key}}">
13-
{{$provider.IconHTML}}
13+
{{$provider.IconHTML 20}}
1414
{{$provider.DisplayName}}
1515
</a>
1616
{{end}}

0 commit comments

Comments
 (0)