{{ template "widget-base.html" . }}

{{ define "widget-content" }}
{{ if ne .Style "dynamic-columns-experimental" }}
<ul class="list list-gap-20 list-with-separator">
    {{ range .Sites }}
    <li class="monitor-site flex items-center gap-15">
        {{ template "site" . }}
    </li>
    {{ end }}
</ul>
{{ else }}
<ul class="dynamic-columns">
    {{ range .Sites }}
    <div class="flex items-center gap-15">
        {{ template "site" . }}
    </div>
    {{ end }}
</ul>
{{ end }}
{{ end }}

{{ define "site" }}
{{ if .IconUrl }}
<img class="monitor-site-icon" src="{{ .IconUrl }}" alt="" loading="lazy">
{{ end }}
<div>
    <a class="size-h3 color-highlight" href="{{ .Url }}" {{ if not .SameTab }}target="_blank"{{ end }} rel="noreferrer">{{ .Title }}</a>
    <ul class="list-horizontal-text">
        {{ if not .Status.Error }}
        <li>{{ .StatusText }}</li>
        <li>{{ .Status.ResponseTime.Milliseconds | formatNumber }}ms</li>
        {{ else if .Status.TimedOut }}
        <li class="color-negative">Timed Out</li>
        {{ else }}
        <li class="color-negative" title="{{ .Status.Error }}">ERROR</li>
        {{ end }}
    </ul>
</div>
{{ if eq .StatusStyle "good" }}
<div class="monitor-site-status-icon">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="var(--color-positive)">
        <path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z" clip-rule="evenodd" />
    </svg>
</div>
{{ else }}
<div class="monitor-site-status-icon">
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="var(--color-negative)">
        <path fill-rule="evenodd" d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z" clip-rule="evenodd" />
    </svg>
</div>
{{ end }}
{{ end }}
