mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
feat: introduce Home model and refactor views
This commit is contained in:
parent
8d8935c045
commit
42c5ab642e
@ -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">
|
||||
|
@ -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,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">
|
||||
|
@ -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 {
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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
pkg/nebula/models/Bento.pkl.go
Normal file
12
pkg/nebula/models/Bento.pkl.go
Normal 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
pkg/nebula/models/CallToAction.pkl.go
Normal file
12
pkg/nebula/models/CallToAction.pkl.go
Normal 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
pkg/nebula/models/Features.pkl.go
Normal file
10
pkg/nebula/models/Features.pkl.go
Normal 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"`
|
||||
}
|
@ -15,4 +15,6 @@ type Hero struct {
|
||||
SecondaryButton *Button `pkl:"secondaryButton"`
|
||||
|
||||
Image *Image `pkl:"image"`
|
||||
|
||||
Stats []*Stat `pkl:"stats"`
|
||||
}
|
||||
|
10
pkg/nebula/models/Highlights.pkl.go
Normal file
10
pkg/nebula/models/Highlights.pkl.go
Normal 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"`
|
||||
}
|
@ -3,6 +3,4 @@ package models
|
||||
|
||||
type Home struct {
|
||||
Hero *Hero `pkl:"hero"`
|
||||
|
||||
Stats *Stats `pkl:"stats"`
|
||||
}
|
||||
|
10
pkg/nebula/models/Lowlights.pkl.go
Normal file
10
pkg/nebula/models/Lowlights.pkl.go
Normal 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"`
|
||||
}
|
@ -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{})
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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))
|
||||
}
|
||||
|
77
pkl/uiux.pkl
77
pkl/uiux.pkl
@ -5,7 +5,7 @@ module models
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ General Components │
|
||||
// │ General State │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
typealias FormState = "initial" | "error" | "success" | "warning"
|
||||
@ -42,18 +42,24 @@ class Input {
|
||||
}
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ Homepage Components │
|
||||
// │ Data Models │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
class Stats {
|
||||
firstValue: String
|
||||
firstLabel: String
|
||||
secondValue: String
|
||||
secondLabel: String
|
||||
thirdValue: String
|
||||
thirdLabel: String
|
||||
class Highlight {
|
||||
title: String
|
||||
description: String
|
||||
image: Image
|
||||
}
|
||||
|
||||
class Stat {
|
||||
value: String
|
||||
label: String
|
||||
}
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ Homepage View Model │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
class Hero {
|
||||
titleFirst: String
|
||||
titleEmphasis: String
|
||||
@ -62,6 +68,39 @@ class Hero {
|
||||
primaryButton: Button
|
||||
secondaryButton: Button
|
||||
image: Image
|
||||
stats: Listing<Stat>
|
||||
}
|
||||
|
||||
class Highlights {
|
||||
title: String
|
||||
description: String
|
||||
image: Image
|
||||
}
|
||||
|
||||
class Features {
|
||||
title: String
|
||||
description: String
|
||||
image: Image
|
||||
}
|
||||
|
||||
class Bento {
|
||||
title: String
|
||||
description: String
|
||||
primaryButton: Button
|
||||
secondaryButton: Button
|
||||
}
|
||||
|
||||
class Lowlights {
|
||||
title: String
|
||||
description: String
|
||||
image: Image
|
||||
}
|
||||
|
||||
class CallToAction {
|
||||
title: String
|
||||
description: String
|
||||
primaryButton: Button
|
||||
secondaryButton: Button
|
||||
}
|
||||
|
||||
class Footer {
|
||||
@ -70,19 +109,17 @@ class Footer {
|
||||
twitterLink: SocialLink
|
||||
discordLink: SocialLink
|
||||
githubLink: SocialLink
|
||||
companyLinks: List<Link>
|
||||
resourcesLinks: List<Link>
|
||||
companyLinks: Listing<Link>
|
||||
resourcesLinks: Listing<Link>
|
||||
}
|
||||
|
||||
class Home {
|
||||
hero: Hero
|
||||
stats: Stats
|
||||
}
|
||||
|
||||
home : Home
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ Registration Components │
|
||||
// │ Registration View Model │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
class RegistrationForm {
|
||||
@ -92,3 +129,15 @@ class RegistrationForm {
|
||||
inputs: List<Input>
|
||||
}
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ Login View Model │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ FINAL INPUTS │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
// Pages
|
||||
home : Home
|
||||
|
Loading…
x
Reference in New Issue
Block a user