This commit is contained in:
bronkuu 2026-05-27 15:28:52 +02:00
parent ef48719cf5
commit c489aa7f3d
6 changed files with 16 additions and 6 deletions

View file

@ -33,7 +33,8 @@ func generateHTML() {
saveFile(`index`, templates.Index()) saveFile(`index`, templates.Index())
saveFile(`kawiarnia`, templates.Kawiarnia()) saveFile(`kawiarnia`, templates.Kawiarnia())
saveFile(`portfolio`, templates.Portfolio()) saveFile(`portfolio`, templates.Portfolio())
saveFile(`wyroby`, templates.WyrobyCiasta(resources.Cakes)) saveFile(`wyroby`, templates.Wyroby(resources.Cakes, "wyroby"))
saveFile(`wyroby_deserki`, templates.Wyroby(resources.Desserts, "wyroby_deserki"))
saveFile(`wyroby_torty`, templates.WyrobyTorty()) saveFile(`wyroby_torty`, templates.WyrobyTorty())
saveFile(`wyroby_slodkie_stoly`, templates.WyrobySlodkieStoly()) saveFile(`wyroby_slodkie_stoly`, templates.WyrobySlodkieStoly())
saveFile(`wyroby_lody`, templates.WyrobyLody()) saveFile(`wyroby_lody`, templates.WyrobyLody())
@ -74,7 +75,7 @@ func mergeStyles() {
func ensureDir() { func ensureDir() {
log.Println("creating directories") log.Println("creating directories")
err := os.MkdirAll("www/styles", 0644) err := os.MkdirAll("www", 0644)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }

View file

@ -18,3 +18,7 @@ var Cakes = []types.Product{
{Name: "Nutelowiec z wiśniami", Image: "013", Price: "120", Description: "nutelowy spód , krem śmietankowy z dodatkiem twarożku, wiśnie i galaretka"}, {Name: "Nutelowiec z wiśniami", Image: "013", Price: "120", Description: "nutelowy spód , krem śmietankowy z dodatkiem twarożku, wiśnie i galaretka"},
{Name: "Karpatka", Image: "014", Price: "120", Description: ""}, {Name: "Karpatka", Image: "014", Price: "120", Description: ""},
} }
var Desserts = []types.Product{
{Name: "Beza Pavlova", Image: "001", Price: "10", Description: "ok"},
}

View file

@ -199,6 +199,7 @@ templ wyrobyHeader(activePage string) {
</p> </p>
<nav> <nav>
@GreenLink(activePage, "wyroby", "Ciasta") @GreenLink(activePage, "wyroby", "Ciasta")
@GreenLink(activePage, "wyroby_deserki", "Deserki")
@GreenLink(activePage, "wyroby_torty", "Torty") @GreenLink(activePage, "wyroby_torty", "Torty")
@GreenLink(activePage, "wyroby_slodkie_stoly", "Słodkie stoły") @GreenLink(activePage, "wyroby_slodkie_stoly", "Słodkie stoły")
@GreenLink(activePage, "wyroby_lody", "Lody") @GreenLink(activePage, "wyroby_lody", "Lody")

View file

@ -226,6 +226,10 @@ func wyrobyHeader(activePage string) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = GreenLink(activePage, "wyroby_deserki", "Deserki").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = GreenLink(activePage, "wyroby_torty", "Torty").Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = GreenLink(activePage, "wyroby_torty", "Torty").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err

View file

@ -18,10 +18,10 @@ templ card(product types.Product) {
</div> </div>
} }
templ WyrobyCiasta(products []types.Product) { templ Wyroby(products []types.Product, page string) {
@layout("wyroby") { @layout("wyroby") {
<main> <main>
@wyrobyHeader("wyroby") @wyrobyHeader(page)
<div id="wyroby"> <div id="wyroby">
for _, product:= range products { for _, product:= range products {
@card(product) @card(product)

View file

@ -107,7 +107,7 @@ func card(product types.Product) templ.Component {
}) })
} }
func WyrobyCiasta(products []types.Product) templ.Component { func Wyroby(products []types.Product, page string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@ -144,7 +144,7 @@ func WyrobyCiasta(products []types.Product) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = wyrobyHeader("wyroby").Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = wyrobyHeader(page).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }