mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 09:51:39 +00:00
refactor: reorganize pkl files for better separation of concerns
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// 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"`
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
type Form interface {
|
||||
GetTitle() string
|
||||
|
||||
GetDescription() string
|
||||
|
||||
GetInputs() []*Input
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
package models
|
||||
|
||||
type Highlights struct {
|
||||
Title string `pkl:"title"`
|
||||
Heading string `pkl:"heading"`
|
||||
|
||||
Description string `pkl:"description"`
|
||||
Subheading string `pkl:"subheading"`
|
||||
|
||||
Image *Image `pkl:"image"`
|
||||
Highlights []*Highlight `pkl:"highlights"`
|
||||
}
|
||||
|
||||
@@ -3,4 +3,16 @@ package models
|
||||
|
||||
type Home struct {
|
||||
Hero *Hero `pkl:"hero"`
|
||||
|
||||
Highlights []*Highlight `pkl:"highlights"`
|
||||
|
||||
Features []*Features `pkl:"features"`
|
||||
|
||||
Bento *Bento `pkl:"bento"`
|
||||
|
||||
Lowlights []*Lowlights `pkl:"lowlights"`
|
||||
|
||||
CallToAction *CallToAction `pkl:"callToAction"`
|
||||
|
||||
Footer *Footer `pkl:"footer"`
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// 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 string `pkl:"type"`
|
||||
Type inputtype.InputType `pkl:"type"`
|
||||
|
||||
Placeholder string `pkl:"placeholder"`
|
||||
|
||||
@@ -14,5 +16,5 @@ type Input struct {
|
||||
|
||||
Help *string `pkl:"help"`
|
||||
|
||||
Required bool `pkl:"required"`
|
||||
Required *bool `pkl:"required"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package formstate
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type FormState string
|
||||
|
||||
const (
|
||||
Initial FormState = "initial"
|
||||
Error FormState = "error"
|
||||
Success FormState = "success"
|
||||
Warning FormState = "warning"
|
||||
)
|
||||
|
||||
// String returns the string representation of FormState
|
||||
func (rcv FormState) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(FormState)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for FormState.
|
||||
func (rcv *FormState) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "initial":
|
||||
*rcv = Initial
|
||||
case "error":
|
||||
*rcv = Error
|
||||
case "success":
|
||||
*rcv = Success
|
||||
case "warning":
|
||||
*rcv = Warning
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid FormState`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -10,15 +10,15 @@ func init() {
|
||||
pkl.RegisterMapping("models#Button", Button{})
|
||||
pkl.RegisterMapping("models#Image", Image{})
|
||||
pkl.RegisterMapping("models#Stat", Stat{})
|
||||
pkl.RegisterMapping("models#Link", Link{})
|
||||
pkl.RegisterMapping("models#SocialLink", SocialLink{})
|
||||
pkl.RegisterMapping("models#Input", Input{})
|
||||
pkl.RegisterMapping("models#Highlight", Highlight{})
|
||||
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{})
|
||||
pkl.RegisterMapping("models#SocialLink", SocialLink{})
|
||||
pkl.RegisterMapping("models#Link", Link{})
|
||||
pkl.RegisterMapping("models#Input", Input{})
|
||||
pkl.RegisterMapping("models#Feature", Feature{})
|
||||
pkl.RegisterMapping("models#Highlights", Highlights{})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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
|
||||
}
|
||||
Reference in New Issue
Block a user