Skip to content

Commit 34290a0

Browse files
Migrate border and margin classes to Tailwind (#29828)
Used all existing css vars, other migrations are 1:1. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent b251e60 commit 34290a0

File tree

17 files changed

+43
-48
lines changed

17 files changed

+43
-48
lines changed

tailwind.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,16 @@ export default {
5555
current: 'currentcolor',
5656
transparent: 'transparent',
5757
},
58+
borderRadius: {
59+
'none': '0',
60+
'sm': '2px',
61+
'DEFAULT': 'var(--border-radius)', // 4px
62+
'md': 'var(--border-radius-medium)', // 6px
63+
'lg': '8px',
64+
'xl': '12px',
65+
'2xl': '16px',
66+
'3xl': '24px',
67+
'full': 'var(--border-radius-circle)', // 50%
68+
},
5869
},
5970
};

templates/devtest/flex-list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
</div>
105105

106106
<h1>If parent provides the padding/margin space:</h1>
107-
<div class="gt-border-secondary gt-py-4">
107+
<div class="tw-border tw-border-secondary gt-py-4">
108108
<div class="flex-list flex-space-fitted">
109109
<div class="flex-item">item 1 (no padding top)</div>
110110
<div class="flex-item">item 2 (no padding bottom)</div>

templates/devtest/gitea-ui.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595

9696
<div>
9797
<h1>Loading</h1>
98-
<div class="is-loading small-loading-icon gt-border-secondary gt-py-2"><span>loading ...</span></div>
99-
<div class="is-loading gt-border-secondary gt-py-4">
98+
<div class="is-loading small-loading-icon tw-border tw-border-secondary gt-py-2"><span>loading ...</span></div>
99+
<div class="is-loading tw-border tw-border-secondary gt-py-4">
100100
<p>loading ...</p>
101101
<p>loading ...</p>
102102
<p>loading ...</p>

templates/org/header.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{{if .Org.Visibility.IsLimited}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</span>{{end}}
88
{{if .Org.Visibility.IsPrivate}}<span class="ui large basic horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</span>{{end}}
99
</span>
10-
<span class="gt-df gt-ac gt-gap-2 gt-ml-auto gt-font-16 tw-whitespace-nowrap">
10+
<span class="gt-df gt-ac gt-gap-2 tw-ml-auto gt-font-16 tw-whitespace-nowrap">
1111
{{if .EnableFeed}}
1212
<a class="ui basic label button gt-mr-0" href="{{.Org.HomeLink}}.rss" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">
1313
{{svg "octicon-rss" 24}}

templates/repo/issue/filter_list.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
{{end}}
4444
{{end}}
4545
{{RenderLabel $.Context ctx.Locale .}}
46-
<p class="gt-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p>
46+
<p class="tw-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p>
4747
</a>
4848
{{end}}
4949
</div>
@@ -108,7 +108,7 @@
108108
</div>
109109
{{range .OpenProjects}}
110110
<a class="{{if $.ProjectID}}{{if eq $.ProjectID .ID}}active selected{{end}}{{end}} item gt-df" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{.ID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">
111-
{{svg .IconName 18 "gt-mr-3 gt-shrink-0"}}<span class="gt-ellipsis">{{.Title}}</span>
111+
{{svg .IconName 18 "gt-mr-3 tw-shrink-0"}}<span class="gt-ellipsis">{{.Title}}</span>
112112
</a>
113113
{{end}}
114114
{{end}}

templates/repo/issue/labels/label_list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</div>
4545
<div class="label-operation gt-df">
4646
{{template "repo/issue/labels/label_archived" .}}
47-
<div class="gt-df gt-ml-auto">
47+
<div class="gt-df tw-ml-auto">
4848
{{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}}
4949
<a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a>
5050
<a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a>

templates/repo/pulls/tab_menu.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{{ctx.Locale.Tr "repo.pulls.tab_files"}}
1616
<span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span>
1717
</a>
18-
<span class="item gt-ml-auto gt-pr-0 gt-font-bold gt-df gt-ac gt-gap-3">
18+
<span class="item tw-ml-auto gt-pr-0 gt-font-bold gt-df gt-ac gt-gap-3">
1919
<span><span class="text green">{{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}}</span> <span class="text red">{{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}</span></span>
2020
<span class="diff-stats-bar">
2121
<div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Diff.TotalAddition "/" "(" .Diff.TotalAddition "+" .Diff.TotalDeletion "+" 0.0 ")"}}%"></div>

templates/repo/settings/options.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,12 @@
116116
<th></th>
117117
</tr>
118118
</thead>
119-
{{end}}
120119
{{if $modifyBrokenPullMirror}}
121120
{{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}}
122121
<tbody>
123122
<tr>
124123
<td colspan="4">
125-
<div class="text red gt-py-4 gt-border-secondary-bottom">{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}</div>
124+
<div class="text red gt-py-4">{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}</div>
126125
</td>
127126
</tr>
128127
</tbody>
@@ -201,8 +200,9 @@
201200
</td>
202201
</tr>
203202
</tbody>
203+
{{end}}{{/* end if: $modifyBrokenPullMirror / $isWorkingPullMirror */}}
204204
</table>
205-
{{end}}{{/* end if: IsMirror */}}
205+
{{end}}{{/* end if .Repository.IsMirror */}}
206206

207207
<table class="ui table">
208208
<thead>

templates/status/500.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</head>
1717
<body>
1818
<div class="full height">
19-
<nav class="ui secondary menu gt-border-secondary-bottom">
19+
<nav class="ui secondary menu">
2020
<div class="ui container gt-df">
2121
<div class="item gt-f1">
2222
<a href="{{AppSubUrl}}/" aria-label="{{ctx.Locale.Tr "home"}}">
@@ -28,6 +28,7 @@
2828
</div>
2929
</div>
3030
</nav>
31+
<div class="divider gt-my-0"></div>
3132
<div role="main" class="page-content status-page-500">
3233
<div class="ui container" >
3334
<style> .ui.message.flash-message { text-align: left; } </style>

templates/user/dashboard/navbar.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
{{if .ContextUser.IsOrganization}}
8080
<div class="right menu">
81-
<a class="{{if .PageIsNews}}active {{end}}item gt-ml-auto" href="{{.ContextUser.DashboardLink}}{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
81+
<a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
8282
{{svg "octicon-rss"}}&nbsp;{{ctx.Locale.Tr "activities"}}
8383
</a>
8484
{{if not .UnitIssuesGlobalDisabled}}

web_src/css/helpers.css

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@ Gitea's private styles use `g-` prefix.
5252
.gt-font-semibold { font-weight: var(--font-weight-semibold) !important; }
5353
.gt-font-bold { font-weight: var(--font-weight-bold) !important; }
5454

55-
.gt-rounded { border-radius: var(--border-radius) !important; }
56-
.gt-rounded-top { border-radius: var(--border-radius) var(--border-radius) 0 0 !important; }
57-
.gt-rounded-bottom { border-radius: 0 0 var(--border-radius) var(--border-radius) !important; }
58-
.gt-rounded-left { border-radius: var(--border-radius) 0 0 var(--border-radius) !important; }
59-
.gt-rounded-right { border-radius: 0 var(--border-radius) var(--border-radius) 0 !important; }
60-
61-
.gt-border-secondary { border: 1px solid var(--color-secondary) !important; }
62-
.gt-border-secondary-top { border-top: 1px solid var(--color-secondary) !important; }
63-
.gt-border-secondary-bottom { border-bottom: 1px solid var(--color-secondary) !important; }
64-
.gt-border-secondary-left { border-left: 1px solid var(--color-secondary) !important; }
65-
.gt-border-secondary-right { border-right: 1px solid var(--color-secondary) !important; }
66-
6755
.interact-fg { color: inherit !important; }
6856
.interact-fg:hover { color: var(--color-primary) !important; }
6957
.interact-fg:active { color: var(--color-primary-active) !important; }
@@ -121,14 +109,6 @@ Gitea's private styles use `g-` prefix.
121109
.gt-my-4 { margin-top: 1rem !important; margin-bottom: 1rem !important; }
122110
.gt-my-5 { margin-top: 2rem !important; margin-bottom: 2rem !important; }
123111

124-
.gt-m-auto { margin: auto !important; }
125-
.gt-mx-auto { margin-left: auto !important; margin-right: auto !important; }
126-
.gt-my-auto { margin-top: auto !important; margin-bottom: auto !important; }
127-
.gt-mt-auto { margin-top: auto !important; }
128-
.gt-mr-auto { margin-right: auto !important; }
129-
.gt-mb-auto { margin-bottom: auto !important; }
130-
.gt-ml-auto { margin-left: auto !important; }
131-
132112
.gt-p-0 { padding: 0 !important; }
133113
.gt-p-1 { padding: .125rem !important; }
134114
.gt-p-2 { padding: .25rem !important; }
@@ -199,8 +179,6 @@ Gitea's private styles use `g-` prefix.
199179
.gt-gap-y-4 { row-gap: 1rem !important; }
200180
.gt-gap-y-5 { row-gap: 2rem !important; }
201181

202-
.gt-shrink-0 { flex-shrink: 0 !important; }
203-
204182
.gt-font-12 { font-size: 12px !important }
205183
.gt-font-13 { font-size: 13px !important }
206184
.gt-font-14 { font-size: 14px !important }

web_src/js/components/DashboardRepoList.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export default sfc; // activate the IDE's Vue plugin
409409
</div>
410410
</overflow-menu>
411411
</div>
412-
<div v-if="repos.length" class="ui attached table segment gt-rounded-bottom">
412+
<div v-if="repos.length" class="ui attached table segment tw-rounded-b">
413413
<ul class="repo-owner-name-list">
414414
<li class="gt-df gt-ac gt-py-3" v-for="repo, index in repos" :class="{'active': index === activeIndex}" :key="repo.id">
415415
<a class="repo-list-link muted" :href="repo.link">
@@ -425,8 +425,9 @@ export default sfc; // activate the IDE's Vue plugin
425425
</a>
426426
</li>
427427
</ul>
428-
<div v-if="showMoreReposLink" class="center gt-py-3 gt-border-secondary-top">
429-
<div class="ui borderless pagination menu narrow">
428+
<div v-if="showMoreReposLink" class="tw-text-center">
429+
<div class="divider gt-my-0"/>
430+
<div class="ui borderless pagination menu narrow gt-my-3">
430431
<a
431432
class="item navigation gt-py-2" :class="{'disabled': page === 1}"
432433
@click="changePage(1)" :title="textFirstPage"
@@ -466,7 +467,7 @@ export default sfc; // activate the IDE's Vue plugin
466467
<svg-icon name="octicon-plus"/>
467468
</a>
468469
</h4>
469-
<div v-if="organizations.length" class="ui attached table segment gt-rounded-bottom">
470+
<div v-if="organizations.length" class="ui attached table segment tw-rounded-b">
470471
<ul class="repo-owner-name-list">
471472
<li class="gt-df gt-ac gt-py-3" v-for="org in organizations" :key="org.name">
472473
<a class="repo-list-link muted" :href="subUrl + '/' + encodeURIComponent(org.name)">

web_src/js/components/DiffCommitSelector.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export default {
204204
</button>
205205
<div class="menu left transition" id="diff-commit-selector-menu" :class="{visible: menuVisible}" v-show="menuVisible" v-cloak :aria-expanded="menuVisible ? 'true': 'false'">
206206
<div class="loading-indicator is-loading" v-if="isLoading"/>
207-
<div v-if="!isLoading" class="vertical item gt-df gt-fc gt-gap-2" id="diff-commit-list-show-all" role="menuitem" @keydown.enter="showAllChanges()" @click="showAllChanges()">
207+
<div v-if="!isLoading" class="vertical item" id="diff-commit-list-show-all" role="menuitem" @keydown.enter="showAllChanges()" @click="showAllChanges()">
208208
<div class="gt-ellipsis">
209209
{{ locale.show_all_commits }}
210210
</div>
@@ -215,7 +215,7 @@ export default {
215215
<!-- only show the show changes since last review if there is a review AND we are commits ahead of the last review -->
216216
<div
217217
v-if="lastReviewCommitSha != null" role="menuitem"
218-
class="vertical item gt-df gt-fc gt-gap-2 gt-border-secondary-top"
218+
class="vertical item"
219219
:class="{disabled: commitsSinceLastReview === 0}"
220220
@keydown.enter="changesSinceLastReviewClick()"
221221
@click="changesSinceLastReviewClick()"
@@ -227,10 +227,10 @@ export default {
227227
{{ commitsSinceLastReview }} commits
228228
</div>
229229
</div>
230-
<span v-if="!isLoading" class="info gt-border-secondary-top text light-2">{{ locale.select_commit_hold_shift_for_range }}</span>
230+
<span v-if="!isLoading" class="info text light-2">{{ locale.select_commit_hold_shift_for_range }}</span>
231231
<template v-for="commit in commits" :key="commit.id">
232232
<div
233-
class="vertical item gt-df gt-gap-2 gt-border-secondary-top" role="menuitem"
233+
class="vertical item" role="menuitem"
234234
:class="{selection: commit.selected, hovered: commit.hovered}"
235235
@keydown.enter.exact="commitClicked(commit.id)"
236236
@keydown.enter.shift.exact="commitClickedShift(commit)"
@@ -285,10 +285,14 @@ export default {
285285
width: 350px;
286286
}
287287
288-
#diff-commit-selector-menu .item {
288+
#diff-commit-selector-menu .item,
289+
#diff-commit-selector-menu .info {
290+
display: flex !important;
289291
flex-direction: row;
290292
line-height: 1.4;
291293
padding: 7px 14px !important;
294+
border-top: 1px solid var(--color-secondary) !important;
295+
gap: 0.25em;
292296
}
293297
294298
#diff-commit-selector-menu .item:focus {

web_src/js/components/RepoCodeFrequency.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export default {
148148
{{ isLoading ? locale.loadingTitle : errorText ? locale.loadingTitleFailed: `Code frequency over the history of ${repoLink.slice(1)}` }}
149149
</div>
150150
<div class="gt-df ui segment main-graph">
151-
<div v-if="isLoading || errorText !== ''" class="gt-tc gt-m-auto">
151+
<div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto">
152152
<div v-if="isLoading">
153153
<SvgIcon name="octicon-sync" class="gt-mr-3 job-status-rotate"/>
154154
{{ locale.loadingInfo }}

web_src/js/components/RepoContributors.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ export default {
353353
</div>
354354
</div>
355355
<div class="gt-df ui segment main-graph">
356-
<div v-if="isLoading || errorText !== ''" class="gt-tc gt-m-auto">
356+
<div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto">
357357
<div v-if="isLoading">
358358
<SvgIcon name="octicon-sync" class="gt-mr-3 job-status-rotate"/>
359359
{{ locale.loadingInfo }}

web_src/js/components/RepoRecentCommits.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export default {
125125
{{ isLoading ? locale.loadingTitle : errorText ? locale.loadingTitleFailed: "Number of commits in the past year" }}
126126
</div>
127127
<div class="gt-df ui segment main-graph">
128-
<div v-if="isLoading || errorText !== ''" class="gt-tc gt-m-auto">
128+
<div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto">
129129
<div v-if="isLoading">
130130
<SvgIcon name="octicon-sync" class="gt-mr-3 job-status-rotate"/>
131131
{{ locale.loadingInfo }}

web_src/js/features/repo-diff-commit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function addLink(parent, href, text, tooltip) {
3939
link.href = href;
4040
link.textContent = text;
4141
if (tooltip) {
42-
link.classList.add('gt-border-secondary', 'gt-rounded');
42+
link.classList.add('tw-border', 'tw-border-secondary', 'tw-rounded');
4343
link.setAttribute('data-tooltip-content', tooltip);
4444
}
4545
parent.append(link);

0 commit comments

Comments
 (0)