chore(release): 0.2.5
[risinglegends.git] / src / server / views / alert.ts
1 import { v4 as uuid } from 'uuid';
2
3 export function Alert(type: 'error' | 'success', text: string): string {
4   return `<div hx-swap-oob="afterbegin:#alerts">
5   <div class="alert ${type}" id="alert-${uuid()}">${text}</div>
6 </div>
7 `
8 }
9
10 export function SuccessAlert(text: string): string {
11   return Alert('success', text);
12 }
13
14 export function ErrorAlert(text: string): string {
15   return Alert('error', text);
16 }