40 lines
2.2 KiB
HTML
40 lines
2.2 KiB
HTML
{{define "tabler_alert"}}
|
|
{{$a := .}}
|
|
{{$icon := $a.Type}}
|
|
{{if eq $a.Type "success"}}{{$icon = "check"}}{{else if eq $a.Type "warning"}}{{$icon = "alert-triangle"}}{{else if eq $a.Type "danger"}}{{$icon = "alert-circle"}}{{else if eq $a.Type "info"}}{{$icon = "info-circle"}}{{end}}
|
|
<div class="alert{{if $a.Important}} alert-important{{else if $a.Minor}} alert-minor{{end}} alert-{{$a.Type}}{{if $a.ShowClose}} alert-dismissible{{end}}{{if $a.Avatar}} alert-avatar{{end}}{{if $a.Class}} {{$a.Class}}{{end}}" role="alert">
|
|
<div class="alert-icon">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon alert-icon">
|
|
{{if eq $icon "check"}}<path d="M5 12l5 5l10 -10"></path>
|
|
{{else if eq $icon "alert-triangle"}}<path d="M12 9v4"></path><path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.871l-8.106 -13.534a1.914 1.914 0 0 0 -3.274 0z"></path><path d="M12 16h.01"></path>
|
|
{{else if eq $icon "alert-circle"}}<path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"></path><path d="M12 8v4"></path><path d="M12 16h.01"></path>
|
|
{{else if eq $icon "info-circle"}}<path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"></path><path d="M12 16v-4"></path><path d="M12 8h.01"></path>
|
|
{{end}}
|
|
</svg>
|
|
</div>
|
|
{{if or $a.Description $a.List}}
|
|
<div>
|
|
<h4 class="alert-heading">{{defaultVal "This is a custom alert box!" $a.Title}}</h4>
|
|
<div class="alert-description">
|
|
{{$a.Description}}
|
|
{{if $a.List}}
|
|
<ul class="alert-list">
|
|
{{range $a.List}}<li>{{.}}</li>{{end}}
|
|
</ul>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{else}}
|
|
{{defaultVal "This is a custom alert box!" $a.Title}}
|
|
{{if $a.Action}}<a href="#" class="alert-action">{{$a.Action}}</a>{{end}}
|
|
{{if $a.Link}}<a href="#" class="alert-link">{{$a.Link}}</a>{{end}}
|
|
{{end}}
|
|
{{if $a.Buttons}}
|
|
<div class="btn-list">
|
|
<a href="#" class="btn btn-{{$a.Type}}">Okay</a>
|
|
<a href="#" class="btn">Cancel</a>
|
|
</div>
|
|
{{end}}
|
|
{{if $a.ShowClose}}<a class="btn-close" data-bs-dismiss="alert" aria-label="close"></a>{{end}}
|
|
</div>
|
|
{{end}}
|