Skip to content

Commit

Permalink
vertical center with flexbox and fix for svg.img
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Feb 11, 2024
1 parent 0898a7e commit 29718cc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
18 changes: 9 additions & 9 deletions templates/shared/webhook/icon.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
{{if eq .HookType "gitea"}}
{{svg "gitea-gitea" $size "img"}}
{{else if eq .HookType "gogs"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/gogs.ico">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/gogs.ico">
{{else if eq .HookType "slack"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/slack.png">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/slack.png">
{{else if eq .HookType "discord"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/discord.png">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/discord.png">
{{else if eq .HookType "dingtalk"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/dingtalk.ico">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/dingtalk.ico">
{{else if eq .HookType "telegram"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/telegram.png">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/telegram.png">
{{else if eq .HookType "msteams"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/msteams.png">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/msteams.png">
{{else if eq .HookType "feishu"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/feishu.png">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/feishu.png">
{{else if eq .HookType "matrix"}}
{{svg "gitea-matrix" $size "img"}}
{{else if eq .HookType "wechatwork"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/wechatwork.png">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/wechatwork.png">
{{else if eq .HookType "packagist"}}
<img class="{{.Class}}" width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/packagist.png">
<img width="{{$size}}" height="{{$size}}" src="{{AssetUrlPrefix}}/img/packagist.png">
{{end}}
4 changes: 2 additions & 2 deletions templates/webhook/new.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<h4 class="ui top attached header">
{{.CustomHeaderTitle}}
<div class="ui right type dropdown">
<div class="text">
{{template "shared/webhook/icon" (dict "Size" .ctxData.Size "HookType" .ctxData.HookType "Class" "gt-vm gt-mr-1")}}
<div class="text gt-df gt-ac">
{{template "shared/webhook/icon" (dict "Size" 20 "HookType" .ctxData.HookType)}}
{{ctx.Locale.Tr (print "repo.settings.web_hook_name_" .ctxData.HookType)}}
</div>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
Expand Down
7 changes: 7 additions & 0 deletions web_src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,13 @@ ol.ui.list li,
color: var(--color-text-light-2);
}

/* extend fomantic style '.ui.dropdown > .text > img' to include svg.img */
.ui.dropdown > .text > .img {
margin-left: 0;
float: none;
margin-right: 0.78571429rem;
}

.ui.dropdown > .text > .description,
.ui.dropdown .menu > .item > .description {
color: var(--color-text-light-2);
Expand Down

0 comments on commit 29718cc

Please sign in to comment.