Remove fomantic button module (#30475)

CSS-only module. Button colors are reduced to this:

<img width="639" alt="Screenshot 2024-04-14 at 15 36 07"
src="https://github.com/go-gitea/gitea/assets/115237/882d6c02-d1de-44f2-b707-db02a9f5070d">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind 2024-04-14 19:53:52 +02:00 committed by GitHub
parent 4c6e2da088
commit 9946353282
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 361 additions and 3099 deletions

View File

@ -49,7 +49,7 @@
</div> </div>
</div> </div>
</div> </div>
<button class="ui small teal button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="?page={{.Page.Paginater.Current}}"> <button class="ui small button" id="delete-selection" data-link="{{.Link}}/delete" data-redirect="?page={{.Page.Paginater.Current}}">
<span class="text">{{ctx.Locale.Tr "admin.notices.delete_selected"}}</span> <span class="text">{{ctx.Locale.Tr "admin.notices.delete_selected"}}</span>
</button> </button>
</th> </th>

View File

@ -54,7 +54,7 @@
<input type="hidden" name="action" value="delete"> <input type="hidden" name="action" value="delete">
<input type="hidden" name="q" value="{{$.Keyword}}"> <input type="hidden" name="q" value="{{$.Keyword}}">
<input type="hidden" name="page" value="{{$.CurrentPage}}"> <input type="hidden" name="page" value="{{$.CurrentPage}}">
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}} {{template "base/modal_actions_confirm"}}
</form> </form>
</div> </div>
</div> </div>

View File

@ -1,7 +1,6 @@
{{/* {{/*
Two buttons (negative, positive): Two buttons (negative, positive):
* ModalButtonTypes: "yes" (default) or "confirm" * ModalButtonTypes: "yes" (default) or "confirm"
* ModalButtonColors: "primary" (default) / "blue" / "yellow"
* ModalButtonCancelText * ModalButtonCancelText
* ModalButtonOkText * ModalButtonOkText
@ -22,14 +21,7 @@ The ".ok.button" and ".cancel.button" selectors are also used by Fomantic Modal
{{end}} {{end}}
{{if .ModalButtonCancelText}}{{$textNegitive = .ModalButtonCancelText}}{{end}} {{if .ModalButtonCancelText}}{{$textNegitive = .ModalButtonCancelText}}{{end}}
{{if .ModalButtonOkText}}{{$textPositive = .ModalButtonOkText}}{{end}} {{if .ModalButtonOkText}}{{$textPositive = .ModalButtonOkText}}{{end}}
{{$stylePositive := "primary"}}
{{if eq .ModalButtonColors "blue"}}
{{$stylePositive = "blue"}}
{{else if eq .ModalButtonColors "yellow"}}
{{$stylePositive = "yellow"}}
{{end}}
<button class="ui cancel button">{{svg "octicon-x"}} {{$textNegitive}}</button> <button class="ui cancel button">{{svg "octicon-x"}} {{$textNegitive}}</button>
<button class="ui {{$stylePositive}} ok button">{{svg "octicon-check"}} {{$textPositive}}</button> <button class="ui primary ok button">{{svg "octicon-check"}} {{$textPositive}}</button>
{{end}} {{end}}
</div> </div>

View File

@ -1,6 +1,15 @@
{{template "base/head" .}} {{template "base/head" .}}
<div class="page-content devtest ui container"> <div class="page-content devtest ui container">
{{template "base/alert" .}} {{template "base/alert" .}}
<div class="modal-buttons flex-text-block tw-flex-wrap"></div>
<script type="module">
for (const el of $('.ui.modal')) {
const $btn = $('<button class="ui button">').text(`${el.id}`).on('click', () => {
$(el).modal({onApprove() {alert('confirmed')}}).modal('show');
});
$('.modal-buttons').append($btn);
}
</script>
<div id="test-modal-form-1" class="ui mini modal"> <div id="test-modal-form-1" class="ui mini modal">
<div class="header">Form dialog (layout 1)</div> <div class="header">Form dialog (layout 1)</div>
@ -54,33 +63,11 @@
{{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}} {{template "base/modal_actions_confirm" (dict "ModalButtonTypes" "confirm")}}
</div> </div>
<div class="ui g-modal-confirm modal" id="test-modal-blue">
<div class="header">Blue dialog</div>
<div class="content">hello, this is the modal dialog content</div>
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "blue")}}
</div>
<div class="ui g-modal-confirm modal" id="test-modal-yellow">
<div class="header">yellow dialog</div>
<div class="content">hello, this is the modal dialog content</div>
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}}
</div>
<div class="ui g-modal-confirm modal" id="test-modal-danger"> <div class="ui g-modal-confirm modal" id="test-modal-danger">
{{svg "octicon-x" 16 "inside close"}} {{svg "octicon-x" 16 "inside close"}}
<div class="header">dangerous action dialog</div> <div class="header">dangerous action dialog</div>
<div class="content">hello, this is the modal dialog content, this is a dangerous operation</div> <div class="content">hello, this is the modal dialog content, this is a dangerous operation</div>
{{template "base/modal_actions_confirm" (dict "ModalButtonDangerText" "I know and must do this is dangerous operation")}} {{template "base/modal_actions_confirm" (dict "ModalButtonDangerText" "I know and must do this is dangerous operation")}}
</div> </div>
<div class="modal-buttons flex-text-block tw-flex-wrap"></div>
<script type="module">
for (const el of $('.ui.modal')) {
const $btn = $('<button>').text(`${el.id}`).on('click', () => {
$(el).modal({onApprove() {alert('confirmed')}}).modal('show');
});
$('.modal-buttons').append($btn);
}
</script>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}

View File

@ -29,41 +29,13 @@
<button class="ui basic button">Basic Unclassed</button> <button class="ui basic button">Basic Unclassed</button>
<button class="ui primary button">Primary</button> <button class="ui primary button">Primary</button>
<button class="ui basic primary button">Basic Primary</button> <button class="ui basic primary button">Basic Primary</button>
<button class="ui negative button">Negative</button>
<button class="ui basic negative button">Basic Negative</button>
<button class="ui positive button">Positive</button>
<button class="ui basic positive button">Basic Positive</button>
</li> </li>
<li class="sample-group"> <li class="sample-group">
<h2>Recommended colors:</h2> <h2>Recommended colors:</h2>
<button class="ui red button">Red</button> <button class="ui red button">Red</button>
<button class="ui basic red button">Basic Red</button> <button class="ui basic red button">Basic Red</button>
<button class="ui primary button">Green</button> <button class="ui green button">Green</button>
<button class="ui basic primary button">Basic Green</button> <button class="ui basic green button">Basic Green</button>
<button class="ui blue button">Blue</button>
<button class="ui basic blue button">Basic Blue</button>
<button class="ui orange button">Orange</button>
<button class="ui basic orange button">Basic Orange</button>
<button class="ui yellow button">Yellow</button>
<button class="ui basic yellow button">Basic Yellow</button>
</li>
<li class="sample-group">
<h2>Supported but not recommended:</h2>
<p>Do not use if there is no strong requirement. Do not use grey/black buttons, they don't work well with dark theme.</p>
<button class="ui secondary button">Secondary</button>
<button class="ui basic secondary button">Basic Secondary</button>
<button class="ui olive button">Olive</button>
<button class="ui basic olive button">Basic Olive</button>
<button class="ui teal button">Teal</button>
<button class="ui basic teal button">Basic Teal</button>
<button class="ui violet button">Violet</button>
<button class="ui basic violet button">Basic Violet</button>
<button class="ui purple button">Purple</button>
<button class="ui basic purple button">Basic Purple</button>
<button class="ui pink button">Pink</button>
<button class="ui basic pink button">Basic Pink</button>
<button class="ui brown button">Brown</button>
<button class="ui basic brown button">Basic Brown</button>
</li> </li>
<li class="sample-group"> <li class="sample-group">
<h2>Inline / Plain:</h2> <h2>Inline / Plain:</h2>
@ -198,7 +170,7 @@
<button class="ui basic button">labeled button</button> <button class="ui basic button">labeled button</button>
<a class="ui basic label">123</a> <a class="ui basic label">123</a>
</div> </div>
<button class="ui yellow button">{{svg "octicon-x" 16}} button with very very very very very very very very long text</button> <button class="ui button">{{svg "octicon-x" 16}} button with very very very very very very very very long text</button>
</div> </div>
<h2>Input with SVG</h2> <h2>Input with SVG</h2>
@ -271,10 +243,6 @@
<span class="text">button dropdown</span> <span class="text">button dropdown</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}}
</div> </div>
<div class="ui dropdown large button">
<span class="text">large dropdown</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
</div>
</div> </div>
<div> <div>
@ -290,10 +258,6 @@
<span class="text">button compact</span> <span class="text">button compact</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}}
</div> </div>
<div class="ui dropdown large compact button">
<span class="text">large compact</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
</div>
</div> </div>
<div> <div>

View File

@ -79,7 +79,7 @@
</div> </div>
{{if .IsOrganizationOwner}} {{if .IsOrganizationOwner}}
<div class="ui bottom attached segment"> <div class="ui bottom attached segment">
<a class="ui teal small button" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/edit">{{svg "octicon-gear"}} {{ctx.Locale.Tr "org.teams.settings"}}</a> <a class="ui small button" href="{{.OrgLink}}/teams/{{.Team.LowerName | PathEscape}}/edit">{{svg "octicon-gear"}} {{ctx.Locale.Tr "org.teams.settings"}}</a>
</div> </div>
{{end}} {{end}}
</div> </div>

View File

@ -5,7 +5,7 @@
{{$branchLink := HTMLFormat `<a href="%s/src/branch/%s">%s</a>` $.RepoLink (PathEscapeSegments .Name) .Name}} {{$branchLink := HTMLFormat `<a href="%s/src/branch/%s">%s</a>` $.RepoLink (PathEscapeSegments .Name) .Name}}
{{ctx.Locale.Tr "repo.pulls.recently_pushed_new_branches" $branchLink $timeSince}} {{ctx.Locale.Tr "repo.pulls.recently_pushed_new_branches" $branchLink $timeSince}}
</div> </div>
<a role="button" class="ui compact positive button tw-m-0" href="{{$.Repository.ComposeBranchCompareURL $.Repository.BaseRepo .Name}}"> <a role="button" class="ui compact green button tw-m-0" href="{{$.Repository.ComposeBranchCompareURL $.Repository.BaseRepo .Name}}">
{{ctx.Locale.Tr "repo.pulls.compare_changes"}} {{ctx.Locale.Tr "repo.pulls.compare_changes"}}
</a> </a>
</div> </div>

View File

@ -184,23 +184,15 @@
{{end}} {{end}}
{{else if and .PageIsComparePull (gt .CommitCount 0)}} {{else if and .PageIsComparePull (gt .CommitCount 0)}}
{{if .HasPullRequest}} {{if .HasPullRequest}}
<div class="ui segment grid title"> <div class="ui segment flex-text-block tw-gap-4">
<div class="twelve wide column issue-title"> {{template "shared/issueicon" .}}
{{ctx.Locale.Tr "repo.pulls.has_pull_request" (print $.RepoLink "/pulls/" .PullRequest.Issue.Index) $.RepoRelPath .PullRequest.Index}} <div class="issue-title tw-break-anywhere">
<h1> {{RenderIssueTitle $.Context .PullRequest.Issue.Title ($.Repository.ComposeMetas ctx) | RenderCodeBlock}}
<span id="issue-title">{{RenderIssueTitle $.Context .PullRequest.Issue.Title ($.Repository.ComposeMetas ctx)}}</span> <span class="index">#{{.PullRequest.Issue.Index}}</span>
<span class="index">#{{.PullRequest.Issue.Index}}</span>
</h1>
</div>
<div class="four wide column middle aligned text right">
{{- if .PullRequest.HasMerged -}}
<a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button purple show-form">{{svg "octicon-git-merge" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a>
{{else if .Issue.IsClosed}}
<a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button red show-form">{{svg "octicon-issue-closed" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a>
{{else}}
<a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button primary show-form">{{svg "octicon-git-pull-request" 16}} {{ctx.Locale.Tr "repo.pulls.view"}}</a>
{{end}}
</div> </div>
<a href="{{$.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui compact button primary">
{{ctx.Locale.Tr "repo.pulls.view"}}
</a>
</div> </div>
{{else}} {{else}}
{{if and $.IsSigned (not .Repository.IsArchived)}} {{if and $.IsSigned (not .Repository.IsArchived)}}

View File

@ -572,7 +572,7 @@
</form> </form>
{{end}} {{end}}
<button class="tw-mt-1 fluid ui show-modal button {{if .Issue.IsLocked}} negative {{end}}" data-modal="#lock"> <button class="tw-mt-1 fluid ui show-modal button{{if .Issue.IsLocked}} red{{end}}" data-modal="#lock">
{{if .Issue.IsLocked}} {{if .Issue.IsLocked}}
{{svg "octicon-key"}} {{svg "octicon-key"}}
{{ctx.Locale.Tr "repo.issues.unlock"}} {{ctx.Locale.Tr "repo.issues.unlock"}}

View File

@ -44,7 +44,7 @@
</p> </p>
<form class="ui form" action="{{$.Link}}/delete/{{.Oid}}" method="post"> <form class="ui form" action="{{$.Link}}/delete/{{.Oid}}" method="post">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}} {{template "base/modal_actions_confirm"}}
</form> </form>
</div> </div>
</div> </div>

View File

@ -37,7 +37,7 @@
</a> </a>
</td> </td>
<td> <td>
<a {{if and .Exists .InRepo}}href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank"{{end}} title="{{.Oid}}" class="ui brown button tw-font-mono"> <a {{if and .Exists .InRepo}}href="{{$.LFSFilesLink}}/show/{{.Oid}}" rel="nofollow" target="_blank"{{end}} title="{{.Oid}}" class="ui button tw-font-mono">
{{ShortSha .Oid}} {{ShortSha .Oid}}
</a> </a>
</td> </td>

View File

@ -6,7 +6,7 @@
<div class="ui right"> <div class="ui right">
<!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button --> <!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button -->
<span data-tooltip-content="{{if or $isNew .Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc_disabled"}}{{end}}"> <span data-tooltip-content="{{if or $isNew .Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc_disabled"}}{{end}}">
<button class="ui teal tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}"> <button class="ui tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}">
<span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span> <span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span>
</button> </button>
</span> </span>

View File

@ -109,7 +109,7 @@
<div class="content"> <div class="content">
<p>{{ctx.Locale.Tr "settings.access_token_deletion_desc"}}</p> <p>{{ctx.Locale.Tr "settings.access_token_deletion_desc"}}</p>
</div> </div>
{{template "base/modal_actions_confirm" (dict "ModalButtonColors" "yellow")}} {{template "base/modal_actions_confirm"}}
</div> </div>
{{template "user/settings/layout_footer" .}} {{template "user/settings/layout_footer" .}}

View File

@ -663,10 +663,6 @@ input:-webkit-autofill:active,
font-size: 0.75em; font-size: 0.75em;
} }
.ui.form .ui.button {
font-weight: var(--font-weight-normal);
}
/* popover box shadows */ /* popover box shadows */
.ui.dropdown .menu, .ui.dropdown .menu,
.ui.upward.dropdown > .menu, .ui.upward.dropdown > .menu,
@ -1347,10 +1343,6 @@ table th[data-sortt-desc] .svg {
vertical-align: middle; vertical-align: middle;
} }
.ui.ui.button {
justify-content: center;
}
.ui.dropdown .ui.label .svg { .ui.dropdown .ui.label .svg {
vertical-align: middle; vertical-align: middle;
} }

View File

@ -52,6 +52,9 @@ only use:
*/ */
.tw-hidden.tw-hidden { display: none !important; } .tw-hidden.tw-hidden { display: none !important; }
/* proposed class from https://github.com/tailwindlabs/tailwindcss/pull/12128 */
.tw-break-anywhere { overflow-wrap: anywhere !important; }
@media (max-width: 767.98px) { @media (max-width: 767.98px) {
/* double selector so it wins over .tw-flex (old .gt-df) etc */ /* double selector so it wins over .tw-flex (old .gt-df) etc */
.not-mobile.not-mobile { .not-mobile.not-mobile {

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,10 @@
top: 1.2em; top: 1.2em;
} }
.ui.modal > .close.inside {
color: inherit;
}
.ui.modal > .close.icon[height="16"] { .ui.modal > .close.icon[height="16"] {
top: 0.7em; /* fomantic uses absolute layout, so if we have special icon size, it needs this trick to align vertically */ top: 0.7em; /* fomantic uses absolute layout, so if we have special icon size, it needs this trick to align vertically */
color: var(--color-text-dark); color: var(--color-text-dark);

View File

@ -654,15 +654,15 @@ td .commit-summary {
padding: 2px .5rem; padding: 2px .5rem;
} }
.repository.view.issue .issue-title .index { .issue-title .index {
color: var(--color-text-light-2); color: var(--color-text-light-2);
} }
.repository.view.issue .issue-title .label { .issue-title .label {
margin-right: 10px; margin-right: 10px;
} }
.repository.view.issue .issue-title .edit-zone { .issue-title .edit-zone {
margin-top: 10px; margin-top: 10px;
} }
@ -1164,14 +1164,6 @@ td .commit-summary {
font-size: 14px; font-size: 14px;
} }
.repository.compare.pull .title .issue-title {
margin-bottom: 0.5rem;
}
.repository.compare.pull .title .issue-title .index {
color: var(--color-text-light-2);
}
.repository .ui.dropdown.filter > .menu { .repository .ui.dropdown.filter > .menu {
margin-top: 1px; margin-top: 1px;
} }

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,6 @@
"admin": false, "admin": false,
"components": [ "components": [
"api", "api",
"button",
"dimmer", "dimmer",
"dropdown", "dropdown",
"form", "form",

View File

@ -138,7 +138,7 @@ export default {
<div v-if="!showActionForm" class="tw-flex"> <div v-if="!showActionForm" class="tw-flex">
<!-- the merge button --> <!-- the merge button -->
<div class="ui buttons merge-button" :class="[mergeForm.emptyCommit ? 'grey' : mergeForm.allOverridableChecksOk ? 'primary' : 'red']" @click="toggleActionForm(true)"> <div class="ui buttons merge-button" :class="[mergeForm.emptyCommit ? '' : mergeForm.allOverridableChecksOk ? 'primary' : 'red']" @click="toggleActionForm(true)">
<button class="ui button"> <button class="ui button">
<svg-icon name="octicon-git-merge"/> <svg-icon name="octicon-git-merge"/>
<span class="button-text"> <span class="button-text">