fix: update hero image height in config.pkl

This commit is contained in:
Prad Nukala 2024-09-30 21:27:02 -04:00
parent 36ad1448df
commit bfa78063a7
6 changed files with 56 additions and 25 deletions

View File

@ -16,7 +16,7 @@ hero = new Hero {
image = new Image { image = new Image {
src = "https://cdn.sonr.id/img/hero-clipped.svg"; src = "https://cdn.sonr.id/img/hero-clipped.svg";
width = "560"; width = "560";
height = "560; height = "560";
}; };
}; };

View File

@ -0,0 +1,40 @@
// 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
}

View File

@ -15,7 +15,7 @@ import (
var embeddedFiles embed.FS var embeddedFiles embed.FS
//go:embed assets/config.pkl //go:embed assets/config.pkl
var config string var config []byte
func getHTTPFS() (http.FileSystem, error) { func getHTTPFS() (http.FileSystem, error) {
fsys, err := fs.Sub(embeddedFiles, "assets") fsys, err := fs.Sub(embeddedFiles, "assets")
@ -27,7 +27,7 @@ func getHTTPFS() (http.FileSystem, error) {
// UseAssets is a middleware that serves static files from the embedded assets // UseAssets is a middleware that serves static files from the embedded assets
func UseAssets(e *echo.Echo) error { func UseAssets(e *echo.Echo) error {
err := models.LoadFromString(context.Background(), config) err := models.LoadFromString(context.Background(), string(config))
if err != nil { if err != nil {
return err return err
} }
@ -38,5 +38,10 @@ func UseAssets(e *echo.Echo) error {
assets := http.FileServer(fsys) assets := http.FileServer(fsys)
e.GET("/", echo.WrapHandler(assets)) e.GET("/", echo.WrapHandler(assets))
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets))) e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)))
e.GET("/_nebula/config", handleGetConfig)
return nil return nil
} }
func handleGetConfig(c echo.Context) error {
return c.Blob(http.StatusOK, "application/octet-stream", config)
}

View File

@ -3,15 +3,7 @@ package pages
import ( import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks" "github.com/onsonr/sonr/pkg/nebula/components/blocks"
) "github.com/onsonr/sonr/pkg/nebula/models/formstate"
type FormState string
const (
InitialForm FormState = "initial"
ErrorForm FormState = "error"
SuccessForm FormState = "success"
WarningForm FormState = "warning"
) )
func Register(c echo.Context) error { func Register(c echo.Context) error {
@ -24,7 +16,7 @@ templ registerView(c echo.Context) {
@blocks.H2("Account Registration") @blocks.H2("Account Registration")
@blocks.Spacer() @blocks.Spacer()
@blocks.Breadcrumbs() @blocks.Breadcrumbs()
@basicInfoForm(InitialForm) @basicInfoForm(formstate.Initial)
@blocks.Spacer() @blocks.Spacer()
@blocks.Button(blocks.GET("/", "#register-view")) { @blocks.Button(blocks.GET("/", "#register-view")) {
@blocks.Text("Cancel") @blocks.Text("Cancel")
@ -33,7 +25,7 @@ templ registerView(c echo.Context) {
} }
} }
templ basicInfoForm(state FormState) { templ basicInfoForm(state formstate.FormState) {
switch (state) { switch (state) {
default: default:
<div class="border rounded-lg shadow-sm bg-card text-neutral-900"> <div class="border rounded-lg shadow-sm bg-card text-neutral-900">

View File

@ -11,15 +11,7 @@ import templruntime "github.com/a-h/templ/runtime"
import ( import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks" "github.com/onsonr/sonr/pkg/nebula/components/blocks"
) "github.com/onsonr/sonr/pkg/nebula/models/formstate"
type FormState string
const (
InitialForm FormState = "initial"
ErrorForm FormState = "error"
SuccessForm FormState = "success"
WarningForm FormState = "warning"
) )
func Register(c echo.Context) error { func Register(c echo.Context) error {
@ -95,7 +87,7 @@ func registerView(c echo.Context) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
templ_7745c5c3_Err = basicInfoForm(InitialForm).Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = basicInfoForm(formstate.Initial).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -149,7 +141,7 @@ func registerView(c echo.Context) templ.Component {
}) })
} }
func basicInfoForm(state FormState) templ.Component { func basicInfoForm(state formstate.FormState) 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 {

View File

@ -4,6 +4,8 @@ module models
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl" import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
typealias FormState = "initial" | "error" | "success" | "warning"
class Image { class Image {
src: String src: String
width: String width: String