feat: introduce Home model and refactor views

This commit is contained in:
Prad Nukala
2024-10-02 20:23:28 -04:00
parent 8d8935c045
commit 42c5ab642e
17 changed files with 154 additions and 44 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
package home
templ MarketingFooter() {
templ Footer() {
<!-- Site footer -->
<footer>
<div class="max-w-5xl mx-auto px-4 sm:px-6">
+1 -1
View File
@@ -8,7 +8,7 @@ package home
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func MarketingFooter() templ.Component {
func Footer() templ.Component {
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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+1 -1
View File
@@ -1,6 +1,6 @@
package home
templ MarketingHeader() {
templ Header() {
<!-- Site header -->
<header class="absolute top-2 md:top-6 w-full z-30">
<div class="px-4 sm:px-6">
+1 -1
View File
@@ -8,7 +8,7 @@ package home
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func MarketingHeader() templ.Component {
func Header() templ.Component {
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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+4 -4
View File
@@ -5,15 +5,15 @@ import (
"github.com/onsonr/sonr/pkg/nebula/models"
)
templ View(hero *models.Hero) {
templ View(home *models.Home) {
@blocks.LayoutNoBody("Sonr.ID", true) {
@MarketingHeader()
@SectionHero(hero)
@Header()
@SectionHero(home.Hero)
@Highlights()
@Features()
@Bento()
@Lowlights()
@CallToAction()
@MarketingFooter()
@Footer()
}
}
+4 -4
View File
@@ -13,7 +13,7 @@ import (
"github.com/onsonr/sonr/pkg/nebula/models"
)
func View(hero *models.Hero) templ.Component {
func View(home *models.Home) templ.Component {
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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@@ -46,7 +46,7 @@ func View(hero *models.Hero) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = MarketingHeader().Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = Header().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -54,7 +54,7 @@ func View(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = SectionHero(hero).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = SectionHero(home.Hero).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -102,7 +102,7 @@ func View(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = MarketingFooter().Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = Footer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+12
View File
@@ -0,0 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Bento struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
PrimaryButton *Button `pkl:"primaryButton"`
SecondaryButton *Button `pkl:"secondaryButton"`
}
+12
View File
@@ -0,0 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type CallToAction struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
PrimaryButton *Button `pkl:"primaryButton"`
SecondaryButton *Button `pkl:"secondaryButton"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Features struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
+2
View File
@@ -15,4 +15,6 @@ type Hero struct {
SecondaryButton *Button `pkl:"secondaryButton"`
Image *Image `pkl:"image"`
Stats []*Stat `pkl:"stats"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Highlights struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
-2
View File
@@ -3,6 +3,4 @@ package models
type Home struct {
Hero *Hero `pkl:"hero"`
Stats *Stats `pkl:"stats"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Lowlights struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
+6 -1
View File
@@ -9,10 +9,15 @@ func init() {
pkl.RegisterMapping("models#Hero", Hero{})
pkl.RegisterMapping("models#Button", Button{})
pkl.RegisterMapping("models#Image", Image{})
pkl.RegisterMapping("models#Stats", Stats{})
pkl.RegisterMapping("models#Stat", Stat{})
pkl.RegisterMapping("models#Link", Link{})
pkl.RegisterMapping("models#SocialLink", SocialLink{})
pkl.RegisterMapping("models#Input", Input{})
pkl.RegisterMapping("models#Highlights", Highlights{})
pkl.RegisterMapping("models#Features", Features{})
pkl.RegisterMapping("models#Bento", Bento{})
pkl.RegisterMapping("models#Lowlights", Lowlights{})
pkl.RegisterMapping("models#CallToAction", CallToAction{})
pkl.RegisterMapping("models#Footer", Footer{})
pkl.RegisterMapping("models#RegistrationForm", RegistrationForm{})
}
+16 -14
View File
@@ -1,6 +1,7 @@
amends "https://pkl.sh/uiux.pkl";
hero = new Hero {
home = new Home {
hero = new Hero {
titleFirst = "Simplified";
titleEmphasis = "self-custody";
titleSecond = "for everyone";
@@ -18,18 +19,19 @@ hero = new Hero {
width = "500";
height = "500";
};
stats {
new Stat {
value = "476K";
label = "Assets packed with power beyond your imagination.";
};
new Stat {
value = "1.44K";
label = "Assets packed with power beyond your imagination.";
};
new Stat {
value = "1.5M+";
label = "Assets packed with power beyond your imagination.";
}
};
};
stats = new Stats {
firstValue = "476K";
firstLabel = "Assets packed with power beyond your imagination.";
secondValue = "1.44K";
secondLabel = "Assets packed with power beyond your imagination.";
thirdValue = "1.5M+";
thirdLabel = "Assets packed with power beyond your imagination.";
};
home = new Home {
hero = hero;
stats = stats;
};
+1 -1
View File
@@ -12,5 +12,5 @@ func Home(c echo.Context) error {
if err != nil {
return err
}
return echoResponse(c, home.View(mdls.Home.Hero))
return echoResponse(c, home.View(mdls.Home))
}