mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-12 16:28:19 +00:00
enhance(ui): restyle toasts (#38842)
Restyle toasts, add success toast to match the alerts. <img width="500" alt="Screenshot 2026-08-09 at 11 33 44" src="https://github.com/user-attachments/assets/d36422b8-0030-41dd-8056-b2d10d86280d" /> Alternatively we could also tint to match the alerts, but I do prefer untinted. <img width="500" alt="Screenshot 2026-08-09 at 11 34 44" src="https://github.com/user-attachments/assets/73fcfde4-618b-424f-9aa9-4ada5c2904f6" /> --------- Signed-off-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
import {showInfoToast, showWarningToast, showErrorToast} from './toast.ts';
|
||||
import type {Toast} from './toast.ts';
|
||||
import {showSuccessToast, showInfoToast, showWarningToast, showErrorToast} from './toast.ts';
|
||||
import {registerGlobalInitFunc} from './observer.ts';
|
||||
import {showFomanticModal} from './fomantic/modal.ts';
|
||||
import {createElementFromHTML} from '../utils/dom.ts';
|
||||
import {html} from '../utils/html.ts';
|
||||
import {showGlobalErrorMessage} from './errors.ts';
|
||||
import {AnsiLineRenderer} from '../render/ansi.ts';
|
||||
|
||||
type LevelMap = Record<string, (message: string) => Toast | null>;
|
||||
import type {Intent} from '../types.ts';
|
||||
|
||||
function initDevtestPage() {
|
||||
const toastButtons = document.querySelectorAll('.toast-test-button');
|
||||
if (toastButtons.length) {
|
||||
const levelMap: LevelMap = {info: showInfoToast, warning: showWarningToast, error: showErrorToast};
|
||||
const levelMap = {success: showSuccessToast, info: showInfoToast, warning: showWarningToast, error: showErrorToast};
|
||||
for (const el of toastButtons) {
|
||||
el.addEventListener('click', () => {
|
||||
const level = el.getAttribute('data-toast-level')!;
|
||||
const level = el.getAttribute('data-toast-level') as Intent;
|
||||
const message = el.getAttribute('data-toast-message')!;
|
||||
levelMap[level](message);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user