[GITEA] Maintain aspect ratio for auth icons
- When specifying an icon URL for a authentication source, it's forced to be an width and height of 20px. However this didn't take into account that icons could have an different aspect ratio of 1:1. - This patch fixes that by instead using `max-width` and `max-height` which will respect other aspect ratios. - Resolves https://codeberg.org/forgejo/forgejo/issues/1234
This commit is contained in:
parent
cb1ec27be4
commit
3482739637
2 changed files with 6 additions and 1 deletions
|
@ -56,7 +56,7 @@ func (p *AuthSourceProvider) DisplayName() string {
|
||||||
|
|
||||||
func (p *AuthSourceProvider) IconHTML() template.HTML {
|
func (p *AuthSourceProvider) IconHTML() template.HTML {
|
||||||
if p.iconURL != "" {
|
if p.iconURL != "" {
|
||||||
img := fmt.Sprintf(`<img class="gt-mr-3" width="20" height="20" src="%s" alt="%s">`,
|
img := fmt.Sprintf(`<img class="gt-mr-3 oauth-provider-icon" src="%s" alt="%s">`,
|
||||||
html.EscapeString(p.iconURL), html.EscapeString(p.DisplayName()),
|
html.EscapeString(p.iconURL), html.EscapeString(p.DisplayName()),
|
||||||
)
|
)
|
||||||
return template.HTML(img)
|
return template.HTML(img)
|
||||||
|
|
|
@ -2289,3 +2289,8 @@ table th[data-sortt-desc] .svg {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: .25rem;
|
gap: .25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.oauth-provider-icon {
|
||||||
|
max-height: 20px;
|
||||||
|
max-width: 20px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue