feat: add static hero section content to homepage

This commit is contained in:
Prad Nukala 2024-10-08 21:06:24 -04:00
parent 8811f56559
commit 3637f27369
36 changed files with 77 additions and 492 deletions

View File

@ -304,7 +304,6 @@ gen-pkl:
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/DWN.pkl go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/DWN.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/ORM.pkl go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/ORM.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/Txns.pkl go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/Txns.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/UIUX.pkl

View File

@ -1,15 +1,13 @@
package dash package dash
import ( import (
"github.com/onsonr/sonr/pkg/nebula/components/home/sections"
"github.com/onsonr/sonr/pkg/nebula/global/styles" "github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/components/home/sections"
"github.com/onsonr/sonr/pkg/nebula/models"
) )
templ View(home *models.Home) { templ View() {
@styles.LayoutNoBody("Sonr.ID", true) { @styles.LayoutNoBody("Sonr.ID", true) {
@sections.Header() @sections.Header()
@sections.SectionHero(home.Hero)
@sections.Highlights() @sections.Highlights()
@sections.Features() @sections.Features()
@sections.Bento() @sections.Bento()

View File

@ -11,10 +11,9 @@ import templruntime "github.com/a-h/templ/runtime"
import ( import (
"github.com/onsonr/sonr/pkg/nebula/components/home/sections" "github.com/onsonr/sonr/pkg/nebula/components/home/sections"
"github.com/onsonr/sonr/pkg/nebula/global/styles" "github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/models"
) )
func View(home *models.Home) templ.Component { func View() 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 {
@ -55,14 +54,6 @@ func View(home *models.Home) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = sections.SectionHero(home.Hero).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = sections.Highlights().Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = sections.Highlights().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

@ -1,15 +1,34 @@
package home package home
import ( import (
"github.com/onsonr/sonr/pkg/nebula/components/home/sections"
"github.com/onsonr/sonr/pkg/nebula/global/styles" "github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/components/home/sections"
"github.com/onsonr/sonr/pkg/nebula/models" "github.com/onsonr/sonr/pkg/nebula/models"
) )
templ View(home *models.Home) { var hero = models.Hero{
TitleFirst: "Simplified",
TitleEmphasis: "self-custody",
TitleSecond: "for everyone",
Subtitle: "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.",
PrimaryButton: &models.Button{Text: "Get Started", Href: "/register"},
SecondaryButton: &models.Button{Text: "Learn More", Href: "/about"},
Image: &models.Image{
Src: "https://cdn.sonr.id/img/hero-clipped.svg",
Width: "500",
Height: "500",
},
Stats: []*models.Stat{
{Value: "476K", Label: "Assets packed with power beyond your imagination."},
{Value: "1.44K", Label: "Assets packed with power beyond your imagination."},
{Value: "1.5M+", Label: "Assets packed with power beyond your imagination."},
},
}
templ View() {
@styles.LayoutNoBody("Sonr.ID", true) { @styles.LayoutNoBody("Sonr.ID", true) {
@sections.Header() @sections.Header()
@sections.SectionHero(home.Hero) @sections.SectionHero(&hero)
@sections.Highlights() @sections.Highlights()
@sections.Features() @sections.Features()
@sections.Bento() @sections.Bento()

View File

@ -14,7 +14,26 @@ import (
"github.com/onsonr/sonr/pkg/nebula/models" "github.com/onsonr/sonr/pkg/nebula/models"
) )
func View(home *models.Home) templ.Component { var hero = models.Hero{
TitleFirst: "Simplified",
TitleEmphasis: "self-custody",
TitleSecond: "for everyone",
Subtitle: "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.",
PrimaryButton: &models.Button{Text: "Get Started", Href: "/register"},
SecondaryButton: &models.Button{Text: "Learn More", Href: "/about"},
Image: &models.Image{
Src: "https://cdn.sonr.id/img/hero-clipped.svg",
Width: "500",
Height: "500",
},
Stats: []*models.Stat{
{Value: "476K", Label: "Assets packed with power beyond your imagination."},
{Value: "1.44K", Label: "Assets packed with power beyond your imagination."},
{Value: "1.5M+", Label: "Assets packed with power beyond your imagination."},
},
}
func View() 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 {
@ -55,7 +74,7 @@ func View(home *models.Home) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = sections.SectionHero(home.Hero).Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = sections.SectionHero(&hero).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

@ -90,11 +90,11 @@ func SectionHero(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = ui.PrimaryButton(hero.PrimaryButton.Href, hero.PrimaryButton.Text).Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = ui.PrimaryButton("/register", "Get Started").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = ui.SecondaryButton(hero.SecondaryButton.Href, hero.SecondaryButton.Text).Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = ui.SecondaryButton("/about", "Learn More").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

@ -1,12 +0,0 @@
// 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"`
}

View File

@ -1,8 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Button struct {
Text string `pkl:"text"`
Href string `pkl:"href"`
}

View File

@ -1,12 +0,0 @@
// 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"`
}

View File

@ -1,12 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Feature struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Icon *string `pkl:"icon"`
Image *Image `pkl:"image"`
}

View File

@ -1,10 +0,0 @@
// 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"`
}

View File

@ -1,18 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Footer struct {
Logo *Image `pkl:"logo"`
MediumLink *SocialLink `pkl:"mediumLink"`
TwitterLink *SocialLink `pkl:"twitterLink"`
DiscordLink *SocialLink `pkl:"discordLink"`
GithubLink *SocialLink `pkl:"githubLink"`
CompanyLinks []*Link `pkl:"companyLinks"`
ResourcesLinks []*Link `pkl:"resourcesLinks"`
}

View File

@ -1,10 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Form interface {
GetTitle() string
GetDescription() string
GetInputs() []*Input
}

View File

@ -1,20 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Hero struct {
TitleFirst string `pkl:"titleFirst"`
TitleEmphasis string `pkl:"titleEmphasis"`
TitleSecond string `pkl:"titleSecond"`
Subtitle string `pkl:"subtitle"`
PrimaryButton *Button `pkl:"primaryButton"`
SecondaryButton *Button `pkl:"secondaryButton"`
Image *Image `pkl:"image"`
Stats []*Stat `pkl:"stats"`
}

View File

@ -1,10 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Highlight struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}

View File

@ -1,10 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Highlights struct {
Heading string `pkl:"heading"`
Subheading string `pkl:"subheading"`
Highlights []*Feature `pkl:"highlights"`
}

View File

@ -1,6 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Home struct {
Hero *Hero `pkl:"hero"`
}

View File

@ -1,10 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Image struct {
Src string `pkl:"src"`
Width string `pkl:"width"`
Height string `pkl:"height"`
}

View File

@ -1,20 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import "github.com/onsonr/sonr/pkg/nebula/models/inputtype"
type Input struct {
Label string `pkl:"label"`
Type inputtype.InputType `pkl:"type"`
Placeholder string `pkl:"placeholder"`
Value *string `pkl:"value"`
Error *string `pkl:"error"`
Help *string `pkl:"help"`
Required *bool `pkl:"required"`
}

View File

@ -1,8 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Link struct {
Text string `pkl:"text"`
Href string `pkl:"href"`
}

View File

@ -1,10 +0,0 @@
// 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"`
}

View File

@ -1,10 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type ModalForm struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Id string `pkl:"id"`
}

View File

@ -1,45 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import (
"context"
"github.com/apple/pkl-go/pkl"
)
type Models struct {
Home *Home `pkl:"home"`
Register *ModalForm `pkl:"register"`
Login *ModalForm `pkl:"login"`
Authorize *ModalForm `pkl:"authorize"`
PrivacyConsent *ModalForm `pkl:"privacyConsent"`
}
// LoadFromPath loads the pkl module at the given path and evaluates it into a Models
func LoadFromPath(ctx context.Context, path string) (ret *Models, err error) {
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
if err != nil {
return nil, err
}
defer func() {
cerr := evaluator.Close()
if err == nil {
err = cerr
}
}()
ret, err = Load(ctx, evaluator, pkl.FileSource(path))
return ret, err
}
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Models
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Models, error) {
var ret Models
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
return nil, err
}
return &ret, nil
}

View File

@ -1,5 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type PublicKeyCreationOptions struct {
}

View File

@ -1,5 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type PublicKeyRequestOptions struct {
}

View File

@ -1,28 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type RegisterFormData interface {
Form
}
var _ RegisterFormData = (*RegisterFormDataImpl)(nil)
type RegisterFormDataImpl struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Inputs []*Input `pkl:"inputs"`
}
func (rcv *RegisterFormDataImpl) GetTitle() string {
return rcv.Title
}
func (rcv *RegisterFormDataImpl) GetDescription() string {
return rcv.Description
}
func (rcv *RegisterFormDataImpl) GetInputs() []*Input {
return rcv.Inputs
}

View File

@ -1,8 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type SocialLink struct {
Link *Link `pkl:"link"`
Icon string `pkl:"icon"`
}

View File

@ -1,8 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Stat struct {
Value string `pkl:"value"`
Label string `pkl:"label"`
}

View File

@ -1,16 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Stats struct {
FirstValue string `pkl:"firstValue"`
FirstLabel string `pkl:"firstLabel"`
SecondValue string `pkl:"secondValue"`
SecondLabel string `pkl:"secondLabel"`
ThirdValue string `pkl:"thirdValue"`
ThirdLabel string `pkl:"thirdLabel"`
}

View File

@ -1,36 +0,0 @@
package models
import (
"context"
"errors"
"github.com/apple/pkl-go/pkl"
)
var models *Models
func LoadFromString(ctx context.Context, s string) (err error) {
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
if err != nil {
return err
}
defer func() {
cerr := evaluator.Close()
if err == nil {
err = cerr
}
}()
ret, err := Load(ctx, evaluator, pkl.TextSource(s))
if err != nil {
return err
}
models = ret
return nil
}
func GetModels() (*Models, error) {
if models == nil {
return nil, errors.New("models not initialized")
}
return models, nil
}

View File

@ -1,13 +0,0 @@
package models
type Event string
const (
// Auth
AuthLoginSuccess Event = "login_success"
AuthLogoutSuccess Event = "logout_success"
AuthRegisterSuccess Event = "register_success"
AuthRegisterFailure Event = "register_failure"
WalletTransactionConfirmed Event = "transaction_confirmed"
)

View File

@ -1,14 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("models", Models{})
pkl.RegisterMapping("models#Home", Home{})
pkl.RegisterMapping("models#Hero", Hero{})
pkl.RegisterMapping("models#Button", Button{})
pkl.RegisterMapping("models#Image", Image{})
pkl.RegisterMapping("models#Stat", Stat{})
pkl.RegisterMapping("models#ModalForm", ModalForm{})
}

View File

@ -1,43 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package inputtype
import (
"encoding"
"fmt"
)
type InputType string
const (
Text InputType = "text"
Password InputType = "password"
Email InputType = "email"
Credential InputType = "credential"
File InputType = "file"
)
// String returns the string representation of InputType
func (rcv InputType) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(InputType)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for InputType.
func (rcv *InputType) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "text":
*rcv = Text
case "password":
*rcv = Password
case "email":
*rcv = Email
case "credential":
*rcv = Credential
case "file":
*rcv = File
default:
return fmt.Errorf(`illegal: "%s" is not a valid InputType`, str)
}
return nil
}

View File

@ -0,0 +1,28 @@
package models
type Button struct {
Text string
Href string
}
type Image struct {
Src string
Width string
Height string
}
type Stat struct {
Value string
Label string
}
type Hero struct {
TitleFirst string
TitleEmphasis string
TitleSecond string
Subtitle string
PrimaryButton *Button
SecondaryButton *Button
Image *Image
Stats []*Stat
}

View File

@ -8,7 +8,6 @@ import (
"github.com/onsonr/sonr/pkg/nebula/components/auth" "github.com/onsonr/sonr/pkg/nebula/components/auth"
"github.com/onsonr/sonr/pkg/nebula/components/home" "github.com/onsonr/sonr/pkg/nebula/components/home"
"github.com/onsonr/sonr/pkg/nebula/models"
) )
// ╭───────────────────────────────────────────────────────────╮ // ╭───────────────────────────────────────────────────────────╮
@ -16,11 +15,7 @@ import (
// ╰───────────────────────────────────────────────────────────╯ // ╰───────────────────────────────────────────────────────────╯
func Home(c echo.Context) error { func Home(c echo.Context) error {
mdls, err := models.GetModels() return render(c, home.View())
if err != nil {
return err
}
return render(c, home.View(mdls.Home))
} }
// ╭───────────────────────────────────────────────────────────╮ // ╭───────────────────────────────────────────────────────────╮

View File

@ -1,57 +0,0 @@
@go.Package { name = "github.com/onsonr/sonr/pkg/nebula/models" }
module models
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
// ╭───────────────────────────────────────────────────────────╮
// │ General State │
// ╰───────────────────────────────────────────────────────────╯
class Button {
text: String
href: String
}
class Image {
src: String
width: String
height: String
}
class Stat {
value: String
label: String
}
class ModalForm {
title: String
description: String
id: String
}
// ╭───────────────────────────────────────────────────────────╮
// │ View Models │
// ╰───────────────────────────────────────────────────────────╯
class Hero {
titleFirst: String
titleEmphasis: String
titleSecond: String
subtitle: String
primaryButton: Button
secondaryButton: Button
image: Image
stats: Listing<Stat>
}
class Home {
hero: Hero
}
home : Home
register: ModalForm
login: ModalForm
authorize: ModalForm
privacyConsent: ModalForm