260 lines
9.1 KiB
Text
260 lines
9.1 KiB
Text
package html
|
||
|
||
import "fmt"
|
||
import "strings"
|
||
|
||
templ layout(activePage string) {
|
||
<!DOCTYPE html>
|
||
<html lang="pl">
|
||
<head>
|
||
<meta charset="UTF-8"/>
|
||
<title>Piekarnik Gosi</title>
|
||
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
||
<meta name="description" content=""/>
|
||
<link href="/style.css" rel="stylesheet"/>
|
||
<link rel="icon" href="/images/favicon.avif"/>
|
||
<script src="/htmx.min.js"></script>
|
||
<script src="/preload.js"></script>
|
||
<script defer src="/album.js"></script>
|
||
</head>
|
||
<body hx-boost="true" hx-ext="preload" preload="mouseover">
|
||
<a href="#" onclick="document.querySelector('main').focus();return false" class="sr-only">Przejdź do treści</a>
|
||
<nav aria-label="Główna nawigacja">
|
||
<div>
|
||
<a href="/">
|
||
<img src="/images/logo.svg" alt="logo"/>
|
||
</a>
|
||
<div>
|
||
@Link(activePage, "index", "Strona Główna")
|
||
@Link(activePage, "wyroby", "Wyroby")
|
||
@Link(activePage, "album", "Album")
|
||
@Link(activePage, "kawiarnia", "Kawiarnia")
|
||
</div>
|
||
<a class="btn" href="#footer">Kontakt</a>
|
||
</div>
|
||
</nav>
|
||
{ children... }
|
||
<footer id="footer">
|
||
<div>
|
||
<div>
|
||
<img src="/images/logo.svg" alt="" style="width: 14rem"/>
|
||
<p>Pasja, natura i domowy smak w każdym kawałku ciasta.</p>
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Lokalizacja</h4>
|
||
<ul>
|
||
<li>
|
||
<a href="https://maps.app.goo.gl/YD3DWUNKBoweKdpb7">
|
||
<div>
|
||
<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="lucide lucide-map-pin-icon lucide-map-pin"
|
||
>
|
||
<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"></path>
|
||
<circle cx="12" cy="10" r="3"></circle>
|
||
</svg>
|
||
<span>Pracownia</span>
|
||
</div>
|
||
<p>
|
||
ul. Polna 7k
|
||
<br/>
|
||
83-314 Somonino
|
||
<a href="tel:+48503186245" style="display: flex; flex-direction: row; align-items:center;">
|
||
<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="lucide lucide-phone-icon lucide-phone"
|
||
>
|
||
<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"></path>
|
||
</svg>
|
||
<span>+48 503 186 245</span>
|
||
</a>
|
||
<br/>
|
||
</p>
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://maps.app.goo.gl/568ax4QLJnXvqbhD9">
|
||
<div>
|
||
<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="lucide lucide-map-pin-icon lucide-map-pin"
|
||
>
|
||
<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"></path>
|
||
<circle cx="12" cy="10" r="3"></circle>
|
||
</svg>
|
||
<span>Kawiarnia</span>
|
||
</div>
|
||
<p>
|
||
ul. Dworcowa 3a
|
||
<br/>
|
||
83-300 Kartuzy
|
||
<a href="tel:+48690214515" style="display: flex; flex-direction: row; align-items:center;">
|
||
<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="lucide lucide-phone-icon lucide-phone"
|
||
>
|
||
<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"></path>
|
||
</svg>
|
||
<span>+48 690 214 515</span>
|
||
</a>
|
||
<br/>
|
||
</p>
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div>
|
||
<h4>Kontakt</h4>
|
||
<ul>
|
||
<li>
|
||
<a href="https://facebook.com/piekarnikgosi">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 48 48">
|
||
<mask id="ipSFacebook0">
|
||
<path
|
||
fill="#fff"
|
||
stroke="#fff"
|
||
stroke-linejoin="round"
|
||
stroke-width="3.8"
|
||
d="M36 12.6h-6.013c-1.086 0-1.967.88-1.967 1.967v6.9H36l-1.169 7.597h-6.81V43h-8.776V29.064H12v-7.597h7.151l.094-7.21l-.013-1.31A7.868 7.868 0 0 1 27.099 5H36v7.6Z"
|
||
></path>
|
||
</mask>
|
||
<path fill="currentColor" d="M0 0h48v48H0z" mask="url(#ipSFacebook0)"></path>
|
||
</svg>
|
||
<span>facebook.com/PiekarnikGosi</span>
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://instagram.com/piekarnikgosi">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 24 24">
|
||
<path
|
||
fill="currentColor"
|
||
d="M17.34 5.46a1.2 1.2 0 1 0 1.2 1.2a1.2 1.2 0 0 0-1.2-1.2Zm4.6 2.42a7.59 7.59 0 0 0-.46-2.43a4.94 4.94 0 0 0-1.16-1.77a4.7 4.7 0 0 0-1.77-1.15a7.3 7.3 0 0 0-2.43-.47C15.06 2 14.72 2 12 2s-3.06 0-4.12.06a7.3 7.3 0 0 0-2.43.47a4.78 4.78 0 0 0-1.77 1.15a4.7 4.7 0 0 0-1.15 1.77a7.3 7.3 0 0 0-.47 2.43C2 8.94 2 9.28 2 12s0 3.06.06 4.12a7.3 7.3 0 0 0 .47 2.43a4.7 4.7 0 0 0 1.15 1.77a4.78 4.78 0 0 0 1.77 1.15a7.3 7.3 0 0 0 2.43.47C8.94 22 9.28 22 12 22s3.06 0 4.12-.06a7.3 7.3 0 0 0 2.43-.47a4.7 4.7 0 0 0 1.77-1.15a4.85 4.85 0 0 0 1.16-1.77a7.59 7.59 0 0 0 .46-2.43c0-1.06.06-1.4.06-4.12s0-3.06-.06-4.12ZM20.14 16a5.61 5.61 0 0 1-.34 1.86a3.06 3.06 0 0 1-.75 1.15a3.19 3.19 0 0 1-1.15.75a5.61 5.61 0 0 1-1.86.34c-1 .05-1.37.06-4 .06s-3 0-4-.06a5.73 5.73 0 0 1-1.94-.3a3.27 3.27 0 0 1-1.1-.75a3 3 0 0 1-.74-1.15a5.54 5.54 0 0 1-.4-1.9c0-1-.06-1.37-.06-4s0-3 .06-4a5.54 5.54 0 0 1 .35-1.9A3 3 0 0 1 5 5a3.14 3.14 0 0 1 1.1-.8A5.73 5.73 0 0 1 8 3.86c1 0 1.37-.06 4-.06s3 0 4 .06a5.61 5.61 0 0 1 1.86.34a3.06 3.06 0 0 1 1.19.8a3.06 3.06 0 0 1 .75 1.1a5.61 5.61 0 0 1 .34 1.9c.05 1 .06 1.37.06 4s-.01 3-.06 4ZM12 6.87A5.13 5.13 0 1 0 17.14 12A5.12 5.12 0 0 0 12 6.87Zm0 8.46A3.33 3.33 0 1 1 15.33 12A3.33 3.33 0 0 1 12 15.33Z"
|
||
></path>
|
||
</svg>
|
||
<span>instagram.com/PiekarnikGosi</span>
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="mailto:gosia@piekarnikgosi.pl">
|
||
<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="lucide lucide-mail-icon lucide-mail"
|
||
>
|
||
<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"></path>
|
||
<rect x="2" y="4" width="20" height="16" rx="2"></rect>
|
||
</svg>
|
||
<span>gosia@piekarnikgosi.pl</span>
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<p>© 2026 Piekarnik Gosi.</p>
|
||
</footer>
|
||
</body>
|
||
</html>
|
||
}
|
||
|
||
templ Link(activePage, targetPage, title string) {
|
||
<a
|
||
if targetPage == "index" {
|
||
href="/"
|
||
} else {
|
||
href={ fmt.Sprint("/", targetPage, "/") }
|
||
}
|
||
if activePage == targetPage {
|
||
aria-current="page"
|
||
}
|
||
>{ title }</a>
|
||
}
|
||
|
||
templ GreenLink(activePage, targetPage, title string) {
|
||
<a
|
||
if targetPage == "index" {
|
||
href="/"
|
||
} else {
|
||
href={ fmt.Sprint("/", targetPage, "/") }
|
||
}
|
||
if activePage == targetPage {
|
||
aria-current="page"
|
||
}
|
||
class="btn-green"
|
||
>{ title }</a>
|
||
}
|
||
|
||
templ subnavHeader(title, description string) {
|
||
<header class="subnav">
|
||
<h1>{ title }</h1>
|
||
<p>{ description }</p>
|
||
<nav aria-label="Kategorie">
|
||
{ children... }
|
||
</nav>
|
||
</header>
|
||
}
|
||
|
||
templ wyrobyHeader(activePage string) {
|
||
@subnavHeader("Nasze słodkości", "Poznaj nasze tradycyjne receptury przekute w nowoczesne formy. Każdy wypiek to historia pasji, a każde lody to powiew naturalnej świeżości") {
|
||
@GreenLink(activePage, "wyroby", "Ciasta")
|
||
@GreenLink(activePage, "wyroby/deserki", "Deserki")
|
||
@GreenLink(activePage, "wyroby/torty", "Torty")
|
||
@GreenLink(activePage, "wyroby/slodkie_stoly", "Słodkie stoły")
|
||
@GreenLink(activePage, "wyroby/lody", "Lody")
|
||
}
|
||
}
|
||
|
||
func to_url(input string) string {
|
||
lower_case := strings.ToLower(input)
|
||
return "album/" + strings.NewReplacer(" ", "_", "ł", "l", "ó", "o").Replace(lower_case)
|
||
}
|
||
|
||
templ albumHeader(activePage string, pages []string) {
|
||
@subnavHeader("Nasze Słodkie Realizacje", "Galeria pasji uwieczniona w kremie i dekoracjach. Zobacz wybrane projekty, które uświetniły wyjątkowe chwile naszych klientów – od bajkowych tortów dla dzieci po eleganckie torty weselne.") {
|
||
for i, name := range pages {
|
||
if i == 0 {
|
||
@GreenLink(activePage, "album", name)
|
||
} else {
|
||
@GreenLink(activePage, to_url(name), name)
|
||
}
|
||
}
|
||
}
|
||
}
|