Skip to content

Commit a96c73f

Browse files
silverwindGiteaBot
andauthored
Remove svg.svg class, restore .rss-icon (#24667)
Fix regression from #24476 where the `svg.svg` class misaligns SVG icons across the site and streched buttons unintentionally in vertical height. Before (button 30.3px): <img width="157" alt="Screenshot 2023-05-11 at 22 09 42" src="https://github.com/go-gitea/gitea/assets/115237/0fd137ab-ab52-4cf8-afca-c45776d526d0"> After (button 30px): <img width="160" alt="Screenshot 2023-05-11 at 22 09 59" src="https://github.com/go-gitea/gitea/assets/115237/4b741f4b-0fd2-4fae-9bee-16a7deb098e8"> [vertical-align: middle](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) is not suitable to align icons to text because > Aligns the middle of the element with the baseline plus half the x-height of the parent. Example of `vertical-align: middle` from MDN: <img width="232" alt="Screenshot 2023-05-11 at 22 29 28" src="https://github.com/go-gitea/gitea/assets/115237/179fb756-85a1-4cab-8219-1a4958f333e2"> So I think the [existing](https://github.com/go-gitea/gitea/blob/365bb77a5497d492836bf823cf780c823db27e8c/web_src/css/svg.css#L3) `vertical-align: text-top` is generally still the best bet: <img width="241" alt="Screenshot 2023-05-11 at 22 34 24" src="https://github.com/go-gitea/gitea/assets/115237/0cd6edf5-12c0-4bdb-8771-a900f5ba2d35"> Co-authored-by: Giteabot <teabot@gitea.io>
1 parent 4b80813 commit a96c73f

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

templates/org/home.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{if .Org.Visibility.IsPrivate}}<span class="ui large basic horizontal label">{{.locale.Tr "org.settings.visibility.private_shortname"}}</span>{{end}}
1111
</span>
1212
{{if .EnableFeed}}
13-
<a class="muted" href="{{.Org.HomeLink}}.rss" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 24}}</a>
13+
<a class="rss-icon gt-mx-3" href="{{.Org.HomeLink}}.rss" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 24}}</a>
1414
{{end}}
1515
</div>
1616
{{if $.RenderedDescription}}<div class="render-content markup">{{$.RenderedDescription|Str2html}}</div>{{end}}

templates/repo/header.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
{{end}}
3737
</div>
3838
{{if $.EnableFeed}}
39-
<a class="muted gt-ml-3" href="{{$.RepoLink}}.rss" data-tooltip-content="{{$.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</a>
39+
<a class="rss-icon gt-ml-3" href="{{$.RepoLink}}.rss" data-tooltip-content="{{$.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</a>
4040
{{end}}
4141
</div>
4242
{{if $.IsPullMirror}}

templates/repo/release_tag_header.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{end}}
1212
</h2>
1313
{{if .EnableFeed}}
14-
<a class="muted gt-mx-3" href="{{.RepoLink}}/{{if .PageIsTagList}}tags{{else}}releases{{end}}.rss" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</a>
14+
<a class="rss-icon gt-mx-3" href="{{.RepoLink}}/{{if .PageIsTagList}}tags{{else}}releases{{end}}.rss" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</a>
1515
{{end}}
1616
</div>
1717
{{if and (not .PageIsTagList) .CanCreateRelease}}

web_src/css/base.css

+5-6
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,6 @@ a.label,
364364
text-decoration: none !important;
365365
}
366366

367-
/* for most cases, we only use our svg icon as inline icon, so we need to make them inline-block and vertical-align: middle */
368-
svg.svg {
369-
display: inline-block;
370-
vertical-align: middle;
371-
}
372-
373367
.ui.red.labels .label,
374368
.ui.ui.ui.red.label,
375369
.ui.red.button,
@@ -2595,6 +2589,11 @@ a.ui.basic.label:hover {
25952589
line-height: .67em;
25962590
}
25972591

2592+
.rss-icon {
2593+
display: inline-flex;
2594+
color: var(--color-text-light-1);
2595+
}
2596+
25982597
table th[data-sortt-asc]:hover,
25992598
table th[data-sortt-desc]:hover {
26002599
background: rgba(0, 0, 0, 0.1) !important;

web_src/js/components/RepoBranchTagSelector.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<div class="scrolling menu" ref="scrollContainer">
4040
<div v-for="(item, index) in filteredItems" :key="item.name" class="item" :class="{selected: item.selected, active: active === index}" @click="selectItem(item)" :ref="'listItem' + index">
4141
{{ item.name }}
42-
<a v-if="enableFeed && mode === 'branches'" role="button" class="ui compact right muted" :href="rssURLPrefix + item.url" target="_blank" @click.stop>
42+
<a v-if="enableFeed && mode === 'branches'" role="button" class="rss-icon ui compact right" :href="rssURLPrefix + item.url" target="_blank" @click.stop>
4343
<svg-icon name="octicon-rss" :size="14"/>
4444
</a>
4545
</div>

0 commit comments

Comments
 (0)