Skip to content

Commit f88ad54

Browse files
Replace 10 more gt- classes with tw- (#29945)
Likely the biggest change of the tailwind refactors. Only thing of note is that `tw-flex-1` resolves to `flex: 1 1 0%` while our `gt-f1` was `flex: 1 1 0`, I don't think it will make any difference. Commands I've ran: ```sh perl -p -i -e 's#gt-vm#tw-align-middle#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-fw#tw-flex-wrap#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-f1#tw-flex-1#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-fc#tw-flex-col#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-sb#tw-justify-between#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-je#tw-justify-end#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-jc#tw-justify-center#g' web_src/js/**/* templates/**/* models/**/* perl -p -i -e 's#gt-ac#tw-content-center#g' web_src/js/**/* templates/**/* models/**/* tests/**/* perl -p -i -e 's#gt-df#tw-flex#g' web_src/js/**/* templates/**/* models/**/* tests/**/* perl -p -i -e 's#gt-dib#tw-inline-block#g' web_src/js/**/* templates/**/* models/**/* tests/**/* Co-authored-by: wxiaoguang <[email protected]>
1 parent 0c55506 commit f88ad54

File tree

123 files changed

+308
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+308
-322
lines changed

docs/content/contributing/guidelines-frontend.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ We recommend [Google HTML/CSS Style Guide](https://google.github.io/styleguide/h
4747
9. Avoid unnecessary `!important` in CSS, add comments to explain why it's necessary if it can't be avoided.
4848
10. Avoid mixing different events in one event listener, prefer to use individual event listeners for every event.
4949
11. Custom event names are recommended to use `ce-` prefix.
50-
12. Prefer using Tailwind CSS which is available via `tw-` prefix, e.g. `tw-relative`. Gitea's helper CSS classes use `gt-` prefix (`gt-df`), while Gitea's own private framework-level CSS classes use `g-` prefix (`g-modal-confirm`).
50+
12. Prefer using Tailwind CSS which is available via `tw-` prefix, e.g. `tw-relative`. Gitea's helper CSS classes use `gt-` prefix (`gt-mono`), while Gitea's own private framework-level CSS classes use `g-` prefix (`g-modal-confirm`).
5151
13. Avoid inline scripts & styles as much as possible, it's recommended to put JS code into JS files and use CSS classes. If inline scripts & styles are unavoidable, explain the reason why it can't be avoided.
5252

5353
### Accessibility / ARIA

docs/content/contributing/guidelines-frontend.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ HTML 页面由[Go HTML Template](https://pkg.go.dev/html/template)渲染。
4747
9. 避免在 CSS 中使用不必要的`!important`,如果无法避免,添加注释解释为什么需要它。
4848
10. 避免在一个事件监听器中混合不同的事件,优先为每个事件使用独立的事件监听器。
4949
11. 推荐使用自定义事件名称前缀`ce-`
50-
12. 建议使用 Tailwind CSS,它可以通过 `tw-` 前缀获得,例如 `tw-relative`. Gitea 自身的助手类 CSS 使用 `gt-` 前缀(`gt-df`),Gitea 自身的私有框架级 CSS 类使用 `g-` 前缀(`g-modal-confirm`)。
50+
12. 建议使用 Tailwind CSS,它可以通过 `tw-` 前缀获得,例如 `tw-relative`. Gitea 自身的助手类 CSS 使用 `gt-` 前缀(`gt-mono`),Gitea 自身的私有框架级 CSS 类使用 `g-` 前缀(`g-modal-confirm`)。
5151
13. 尽量避免内联脚本和样式,建议将JS代码放入JS文件中并使用CSS类。如果内联脚本和样式不可避免,请解释无法避免的原因。
5252

5353
### 可访问性 / ARIA

models/avatars/avatar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424

2525
const (
2626
// DefaultAvatarClass is the default class of a rendered avatar
27-
DefaultAvatarClass = "ui avatar gt-vm"
27+
DefaultAvatarClass = "ui avatar tw-align-middle"
2828
// DefaultAvatarPixelSize is the default size in pixels of a rendered avatar
2929
DefaultAvatarPixelSize = 28
3030
)

templates/admin/emails/list.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
{{ctx.Locale.Tr "admin.emails.email_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}})
55
</h4>
66
<div class="ui attached segment">
7-
<div class="ui secondary filter menu gt-ac gt-mx-0">
8-
<form class="ui form ignore-dirty gt-f1">
7+
<div class="ui secondary filter menu tw-content-center gt-mx-0">
8+
<form class="ui form ignore-dirty tw-flex-1">
99
{{template "shared/search/combo" dict "Value" .Keyword}}
1010
</form>
1111
<!-- Sort -->

templates/admin/notice.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<tbody>
1818
{{range .Notices}}
1919
<tr>
20-
<td><div class="ui checkbox gt-df" data-id="{{.ID}}"><input type="checkbox"></div></td>
20+
<td><div class="ui checkbox tw-flex" data-id="{{.ID}}"><input type="checkbox"></div></td>
2121
<td>{{.ID}}</td>
2222
<td>{{ctx.Locale.Tr .TrStr}}</td>
2323
<td class="view-detail auto-ellipsis" style="width: 80%;"><span class="notice-description">{{.Description}}</span></td>

templates/admin/org/list.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
</div>
88
</h4>
99
<div class="ui attached segment">
10-
<div class="ui secondary filter menu gt-ac gt-mx-0">
11-
<form class="ui form ignore-dirty gt-f1">
10+
<div class="ui secondary filter menu tw-content-center gt-mx-0">
11+
<form class="ui form ignore-dirty tw-flex-1">
1212
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.org_kind")}}
1313
</form>
1414
<!-- Sort -->

templates/admin/queue_manage.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
-
3131
{{else}}
3232
{{$sum}}
33-
<form action="{{$.Link}}/remove-all-items" method="post" class="gt-dib gt-ml-4">
33+
<form action="{{$.Link}}/remove-all-items" method="post" class="tw-inline-block gt-ml-4">
3434
{{$.CsrfTokenHtml}}
3535
<button class="ui tiny basic red button">{{ctx.Locale.Tr "admin.monitor.queue.settings.remove_all_items"}}</button>
3636
</form>

templates/admin/repo/unadopted.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
{{if .Dirs}}
2121
<div class="ui aligned divided list">
2222
{{range $dirI, $dir := .Dirs}}
23-
<div class="item gt-df gt-ac">
24-
<span class="gt-f1"> {{svg "octicon-file-directory-fill"}} {{$dir}}</span>
23+
<div class="item tw-flex tw-content-center">
24+
<span class="tw-flex-1"> {{svg "octicon-file-directory-fill"}} {{$dir}}</span>
2525
<div>
2626
<button class="ui button primary show-modal gt-p-3" data-modal="#adopt-unadopted-modal-{{$dirI}}">{{svg "octicon-plus"}} {{ctx.Locale.Tr "repo.adopt_preexisting_label"}}</button>
2727
<div class="ui g-modal-confirm modal" id="adopt-unadopted-modal-{{$dirI}}">

templates/admin/stacktrace-row.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="item">
2-
<div class="gt-df gt-ac">
2+
<div class="tw-flex tw-content-center">
33
<div class="icon gt-ml-3 gt-mr-3">
44
{{if eq .Process.Type "request"}}
55
{{svg "octicon-globe" 16}}
@@ -11,7 +11,7 @@
1111
{{svg "octicon-code" 16}}
1212
{{end}}
1313
</div>
14-
<div class="content gt-f1">
14+
<div class="content tw-flex-1">
1515
<div class="header">{{.Process.Description}}</div>
1616
<div class="description">{{if ne .Process.Type "none"}}{{TimeSince .Process.Start ctx.Locale}}{{end}}</div>
1717
</div>
@@ -40,9 +40,9 @@
4040
</summary>
4141
<div class="list">
4242
{{range .Entry}}
43-
<div class="item gt-df gt-ac">
43+
<div class="item tw-flex tw-content-center">
4444
<span class="icon gt-mr-4">{{svg "octicon-dot-fill" 16}}</span>
45-
<div class="content gt-f1">
45+
<div class="content tw-flex-1">
4646
<div class="header"><code>{{.Function}}</code></div>
4747
<div class="description"><code>{{.File}}:{{.Line}}</code></div>
4848
</div>

templates/admin/stacktrace.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin monitor")}}
22
<div class="admin-setting-content">
33

4-
<div class="gt-df gt-ac">
5-
<div class="gt-f1">
4+
<div class="tw-flex tw-content-center">
5+
<div class="tw-flex-1">
66
<div class="ui compact small menu">
77
<a class="{{if eq .ShowGoroutineList "process"}}active {{end}}item" href="?show=process">{{ctx.Locale.Tr "admin.monitor.process"}}</a>
88
<a class="{{if eq .ShowGoroutineList "stacktrace"}}active {{end}}item" href="?show=stacktrace">{{ctx.Locale.Tr "admin.monitor.stacktrace"}}</a>

0 commit comments

Comments
 (0)