flattening
This commit is contained in:
parent
e829562062
commit
5610b28254
3 changed files with 95 additions and 128 deletions
|
|
@ -82,7 +82,7 @@ func (h *Server) orders(r *http.Request) (templ.Component, int, error) {
|
|||
}
|
||||
|
||||
if r.Header.Get("HX-Request") == "true" {
|
||||
return templates.OrdersContent(orders, cakeCounts, specialCakes, firstStr, lastStr, specialFilter), http.StatusOK, nil
|
||||
return templates.MainContent("Panel główny", templates.OrdersContent(orders, cakeCounts, specialCakes, firstStr, lastStr, specialFilter)), http.StatusOK, nil
|
||||
}
|
||||
|
||||
counts, err := h.s.GetOrderCounts()
|
||||
|
|
|
|||
|
|
@ -1,113 +1,106 @@
|
|||
body {
|
||||
display: grid;
|
||||
grid-template-rows: var(--topnav-h) 1fr;
|
||||
height: 100dvh;
|
||||
}
|
||||
display: grid;
|
||||
grid-template-rows: var(--topnav-h) 1fr;
|
||||
height: 100dvh;
|
||||
|
||||
.topnav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-md);
|
||||
padding: 0 var(--space-lg);
|
||||
border-bottom: 1px solid var(--outline-dim);
|
||||
background: var(--surface);
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.topnav > h1 {
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.topnav > nav {
|
||||
display: flex;
|
||||
gap: var(--space-xs);
|
||||
}
|
||||
|
||||
.topnav > nav > a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
padding: var(--space-sm) var(--space-md);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: var(--on-surface-dim);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.topnav > nav > a.active {
|
||||
background: var(--primary-container);
|
||||
color: var(--primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.topnav > .cta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
height: 2.25rem;
|
||||
padding: 0 var(--space-md);
|
||||
background: var(--primary);
|
||||
color: var(--on-primary);
|
||||
border: none;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
flex-shrink: 0;
|
||||
> header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: end;
|
||||
gap: var(--space-md);
|
||||
padding: 0 var(--space-lg);
|
||||
border-bottom: 1px solid var(--outline-dim);
|
||||
background: var(--surface);
|
||||
z-index: 30;
|
||||
> nav {
|
||||
display: flex;
|
||||
gap: var(--space-xs);
|
||||
a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
padding: var(--space-sm) var(--space-md);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: var(--on-surface-dim);
|
||||
text-decoration: none;
|
||||
&.active {
|
||||
background: var(--primary-container);
|
||||
color: var(--primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
}
|
||||
> .cta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
height: 2.25rem;
|
||||
padding: 0 var(--space-md);
|
||||
background: var(--primary);
|
||||
color: var(--on-primary);
|
||||
border: none;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
overflow-y: auto;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding: var(--space-md);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--space-md);
|
||||
align-content: start;
|
||||
padding: var(--space-md);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--space-md);
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.main-content > .horizontal-group {
|
||||
grid-column: 1 / -1;
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
#orders-results {
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--space-md);
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--space-md);
|
||||
}
|
||||
|
||||
@media (max-width: 48em) {
|
||||
.topnav {
|
||||
padding: 0 var(--space-sm);
|
||||
gap: var(--space-xs);
|
||||
}
|
||||
.topnav {
|
||||
padding: 0 var(--space-sm);
|
||||
gap: var(--space-xs);
|
||||
}
|
||||
|
||||
.topnav > nav > a span:not(.material-symbols-outlined) {
|
||||
display: none;
|
||||
}
|
||||
.topnav > nav > a span:not(.material-symbols-outlined) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.topnav > .cta span:not(.material-symbols-outlined) {
|
||||
display: none;
|
||||
}
|
||||
.topnav > .cta span:not(.material-symbols-outlined) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.topnav > .cta {
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
justify-content: center;
|
||||
}
|
||||
.topnav > .cta {
|
||||
width: 2.25rem;
|
||||
height: 2.25rem;
|
||||
padding: 0;
|
||||
border-radius: 50%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding: var(--space-sm);
|
||||
}
|
||||
.main-content {
|
||||
padding: var(--space-sm);
|
||||
}
|
||||
|
||||
.topnav > h1 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
.topnav > h1 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ templ Layout(title string, main templ.Component) {
|
|||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>{ title } — Zamówienia ciast</title>
|
||||
<title>Zamówienia ciast</title>
|
||||
<link rel="stylesheet" href="/static/fonts/inter.css"/>
|
||||
<link rel="stylesheet" href="/static/fonts/material.css"/>
|
||||
<link rel="stylesheet" href="/static/style.css"/>
|
||||
|
|
@ -14,62 +14,36 @@ templ Layout(title string, main templ.Component) {
|
|||
<script src="/static/order.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="topnav">
|
||||
<h1>{ title }</h1>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="/orders" hx-get="/orders" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
|
||||
<a href="/orders" hx-boost="true" hx-target="main" hx-select="main" hx-select-oob="title" hx-swap="outerHTML">
|
||||
<span class="material-symbols-outlined">dashboard</span>
|
||||
<span>Panel główny</span>
|
||||
</a>
|
||||
<a href="/cakes" hx-get="/cakes" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
|
||||
<a href="/cakes" hx-boost="true" hx-target="main" hx-select="main" hx-select-oob="title" hx-swap="outerHTML">
|
||||
<span class="material-symbols-outlined">inventory_2</span>
|
||||
<span>Katalog</span>
|
||||
</a>
|
||||
<a href="/blocked" hx-get="/blocked" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
|
||||
<a href="/blocked" hx-boost="true" hx-target="main" hx-select="main" hx-select-oob="title" hx-swap="outerHTML">
|
||||
<span class="material-symbols-outlined">event_busy</span>
|
||||
<span>Terminy zablokowane</span>
|
||||
</a>
|
||||
</nav>
|
||||
<a href="/order" class="cta" hx-get="/order" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
|
||||
<a href="/order" class="cta" hx-boost="true" hx-target="main" hx-select="main" hx-select-oob="title" hx-swap="outerHTML">
|
||||
<span class="material-symbols-outlined">add</span>
|
||||
<span>Nowe zamówienie</span>
|
||||
</a>
|
||||
</header>
|
||||
<main id="main">
|
||||
<div class="main-content">
|
||||
@main
|
||||
</div>
|
||||
<main>
|
||||
@main
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
|
||||
templ MainContent(title string, main templ.Component) {
|
||||
<header class="topnav" hx-swap-oob="true">
|
||||
<h1>{ title }</h1>
|
||||
<nav>
|
||||
<a href="/orders" hx-get="/orders" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
|
||||
<span class="material-symbols-outlined">dashboard</span>
|
||||
<span>Panel główny</span>
|
||||
</a>
|
||||
<a href="/cakes" hx-get="/cakes" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
|
||||
<span class="material-symbols-outlined">inventory_2</span>
|
||||
<span>Katalog</span>
|
||||
</a>
|
||||
<a href="/blocked" hx-get="/blocked" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
|
||||
<span class="material-symbols-outlined">event_busy</span>
|
||||
<span>Terminy zablokowane</span>
|
||||
</a>
|
||||
</nav>
|
||||
<a href="/order" class="cta" hx-get="/order" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
|
||||
<span class="material-symbols-outlined">add</span>
|
||||
<span>Nowe zamówienie</span>
|
||||
</a>
|
||||
</header>
|
||||
<main id="main">
|
||||
<title hx-swap-oob="true">{ title } — Zamówienia ciast</title>
|
||||
<div class="main-content">
|
||||
@main
|
||||
</div>
|
||||
<title>{ title }</title>
|
||||
<main>
|
||||
@main
|
||||
</main>
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue