rentease/internal/view/layout/public.templ
2024-05-19 21:37:17 +02:00

81 lines
2.1 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package layout
import (
"fmt"
"github.com/rjNemo/rentease/config"
)
type HostViewModel struct {
Name string
Address string
ZipCode string
City string
PhoneNumber string
PhoneUrl templ.SafeURL
Email string
EmailUrl templ.SafeURL
Items []Item
}
type Item struct {
Name string
Url templ.SafeURL
}
var host = config.NewHost()
var hvm = &HostViewModel{
Name: host.Name,
PhoneNumber: host.PhoneNumber,
PhoneUrl: templ.SafeURL(fmt.Sprintf("tel:%s", host.PhoneNumber)),
Email: host.Email,
EmailUrl: templ.SafeURL(fmt.Sprintf("mailto:%s", host.Email)),
Items: []Item{
{"T2 Corail", templ.URL("logements/t2")},
{"T3 Azur", templ.URL("logements/t3")},
},
}
templ PublicLayout() {
<!DOCTYPE html>
<html lang="fr" data-theme="light">
<head>
<title>{ hvm.Name } | Locations de vacances au Gosier en Guadeloupe</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="description" content="Locations de vacances au Gosier en Guadeloupe"/>
<link rel="icon" href="/static/icons/favicon.png"/>
<link rel="stylesheet" href="/static/css/pico.min.css"/>
<link rel="stylesheet" href="/static/css/auth.css"/>
<script src="/static/js/htmx.js" defer></script>
</head>
<body hx-boost="false">
<nav class="container-fluid">
<ul>
<li>
<a href="/"><img src="/static/img/logo.png" alt="logo de villafleurie" width="50px"/> </a>
</li>
</ul>
<ul>
<li>
<details class="dropdown">
<summary>Logements</summary>
<ul dir="rtl">
for _, l := range hvm.Items {
<li><a href={ l.Url }>{ l.Name }</a></li>
}
</ul>
</details>
</li>
<li><a href="/book" role="button">Book Now</a></li>
</ul>
</nav>
<main class="container">
{ children... }
</main>
<footer class="container">
<small>{ hvm.Name } &copy 2024 Telephone : <a href={ hvm.PhoneUrl }>{ hvm.PhoneNumber }</a> Email : <a href={ hvm.EmailUrl }>{ hvm.Email }</a> </small>
</footer>
</body>
</html>
}