fix(ui): make user cards full width on mobile (#40408)

Use "display: grid" for "user-cards" list to make sure the card width is
correct for all widths.

Also clean up and simplify tailwind font size helper classes.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Nekyllandwxiaoguang authored and GitHub committed 2026-11-17 20:26:32 +00:00
1 parent a390f32bb4
commit 57e496dbda
4 files changed
+33 -57

No files matched your search

+5 -13
View File
@@ -73,21 +73,13 @@ export default {
semibold: 'var(--font-weight-semibold)',
bold: 'var(--font-weight-bold)',
},
fontSize: { // rarely used, but "text-base" (matching body's 1em=14px) is useful to reset font-size in a header container
fontSize: {
'xs': '11px',
'sm': '12px',
'base': '14px',
'lg': '18px',
'xl': '20px',
'2xl': '24px',
'3xl': '30px',
'4xl': '36px',
'5xl': '48px',
'6xl': '60px',
'7xl': '72px',
'8xl': '96px',
'9xl': '128px',
...Object.fromEntries(Array.from({length: 100}, (_, i) => {
'base': '14px', // match body's 1em=14px
'lg': '16px',
'xl': '18px',
...Object.fromEntries(Array.from({length: 48}, (_, i) => {
return [String(i), i === 0 ? '0' : `${i}px`];
})),
},
+1 -1
View File
@@ -3,7 +3,7 @@
<div class="flex-relaxed-list tw-flex-1">
<div class="ui header flex-left-right tw-m-0">
<div class="flex-text-block">
<span class="tw-text-2xl">{{.Org.DisplayName}}</span>
<span class="tw-text-24">{{.Org.DisplayName}}</span>
{{if .Org.Visibility.IsLimited}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</span>{{end}}
{{if .Org.Visibility.IsPrivate}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</span>{{end}}
</div>
+18 -19
View File
@@ -1,26 +1,25 @@
{{/* need to reload after "watch/unwatch" or "star/unstar" fetch actions */}}
<div class="user-cards" id="user-cards-container" data-fetch-trigger="fetch-reload">
{{if .CardsTitle}}
<h2 class="ui dividing header">
{{.CardsTitle}}
</h2>
<h2 class="ui dividing header">{{.CardsTitle}}</h2>
{{end}}
<ul class="list">
{{range .Cards}}
<li class="item ui segment">
<a href="{{.HomeLink}}">
{{ctx.AvatarUtils.Avatar . 48}}
</a>
<h3 class="name flex-text-block"><a href="{{.HomeLink}}">{{.DisplayName}}</a>{{template "shared/user/user_type_label" .}}</h3>
<div class="meta flex-text-block">
{{if .Website}}
{{svg "octicon-link"}} <a href="{{.Website}}" target="_blank">{{.Website}}</a>
{{else if .Location}}
{{svg "octicon-location"}} {{.Location}}
{{else}}
{{svg "octicon-calendar"}} {{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort .CreatedUnix)}}
{{end}}
<ul>
{{range $card := .Cards}}
<li class="ui segment">
<a href="{{$card.HomeLink}}">{{ctx.AvatarUtils.Avatar $card 48}}</a>
<div class="flex-relaxed-list">
<div class="item tw-text-xl">
{{template "shared/user/name" $card}}
</div>
<div class="item flex-text-inline">
{{if $card.Website}}
{{svg "octicon-link"}} <a href="{{$card.Website}}" target="_blank" class="muted">{{$card.Website}}</a>
{{else if $card.Location}}
{{svg "octicon-location"}} <span>{{$card.Location}}</span>
{{else}}
{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort $card.CreatedUnix)}}</span>
{{end}}
</div>
</div>
</li>
{{end}}
+9 -24
View File
@@ -983,34 +983,19 @@
padding: 0 10px;
}
.user-cards .list {
.user-cards > ul {
margin: 0;
padding: 0;
display: flex;
flex-wrap: wrap;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr));
gap: var(--gap-block);
}
.user-cards .list .item {
.user-cards > ul > li.ui.segment {
margin: 0;
list-style: none;
width: 32%;
margin: 10px 10px 10px 0;
padding-bottom: 14px;
float: left;
}
.user-cards .list .item .avatar {
float: left;
display: block;
margin-right: 10px;
}
.user-cards .list .item .name {
margin-top: 0;
margin-bottom: 0;
font-weight: var(--font-weight-normal);
}
.user-cards .list .item .meta {
margin-top: 5px;
display: flex;
gap: var(--gap-block);
}
#search-user-box .results .result .image {