Compare commits
No commits in common. "d54fff9c85d0d61f91f9d3ef7e40fa0566a7b88d" and "fbf56fdec829d5665ae9cdbd3c164c76c2db94ca" have entirely different histories.
d54fff9c85
...
fbf56fdec8
@ -12,8 +12,7 @@ type guestbookForm struct {
|
||||
name string
|
||||
message string
|
||||
|
||||
gbModalOpen bool
|
||||
OnSubmit func(
|
||||
OnSubmit func(
|
||||
name string,
|
||||
message string,
|
||||
) // Handler to implement which calls the api
|
||||
@ -46,23 +45,9 @@ func (g *guestbookForm) Render() app.UI {
|
||||
if g.name == "" || g.message == "" {
|
||||
fmt.Printf("Error: one or more field(s) are empty. For now unhandled\n")
|
||||
}
|
||||
if len(g.name) > 40 || len(g.message) > 360 {
|
||||
fmt.Printf("Error: Your message is too long fucker\n")
|
||||
g.gbModalOpen = true
|
||||
return
|
||||
}
|
||||
g.clear()
|
||||
g.OnSubmit(g.name, g.message)
|
||||
g.clear()
|
||||
}),
|
||||
app.If(
|
||||
g.gbModalOpen,
|
||||
&guestbookAlertModal{
|
||||
OnClose: func() {
|
||||
g.gbModalOpen = false
|
||||
g.Update()
|
||||
},
|
||||
},
|
||||
),
|
||||
).Class("content")
|
||||
}
|
||||
|
||||
@ -70,32 +55,3 @@ func (g *guestbookForm) clear() {
|
||||
g.name = ""
|
||||
g.message = ""
|
||||
}
|
||||
|
||||
type guestbookAlertModal struct {
|
||||
app.Compo
|
||||
|
||||
PreviousAttempts int
|
||||
OnClose func() // For when we close the modal
|
||||
}
|
||||
|
||||
func (g *guestbookAlertModal) Render() app.UI {
|
||||
return app.Div().
|
||||
Class("gb-modal").
|
||||
ID("gbModal").
|
||||
OnClick(func(ctx app.Context, e app.Event) {
|
||||
g.OnClose()
|
||||
}).
|
||||
Body(
|
||||
app.Div().
|
||||
Class("gb-modal-content").
|
||||
Body(
|
||||
app.Span().Class("close").Text("X").
|
||||
OnClick(func(ctx app.Context, e app.Event) {
|
||||
//modal := app.Window().GetElementByID("gbModal")
|
||||
//modal.Set("style", "none")
|
||||
g.OnClose()
|
||||
}),
|
||||
app.P().Text("Your name must be <= 40 and your message must be <= 360 characters"),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
23
main.go
23
main.go
@ -31,28 +31,9 @@ func main() {
|
||||
// It exits immediately on the server side
|
||||
app.RunWhenOnBrowser()
|
||||
|
||||
icon := &app.Icon{
|
||||
Default: "/web/static/images/icon-small.png",
|
||||
Large: "/web/static/images/icon.png",
|
||||
}
|
||||
handler := &app.Handler{
|
||||
Name: "Internetica Galactica",
|
||||
Icon: *icon,
|
||||
BackgroundColor: "#362730",
|
||||
ThemeColor: "#362730",
|
||||
LoadingLabel: "Internetica Galactica",
|
||||
Title: "Internetica Galactica",
|
||||
Description: "A 1990's style PWA!",
|
||||
Author: "Quenten",
|
||||
Keywords: []string{
|
||||
"Based website",
|
||||
"Cool website",
|
||||
"PWA",
|
||||
"Programming",
|
||||
"Go", "Golang",
|
||||
"Webassembly", "WASM",
|
||||
"DutchEllie", "Quenten",
|
||||
},
|
||||
Name: "Internetica Galactica",
|
||||
Description: "A 1990's style PWA!",
|
||||
Styles: []string{
|
||||
"/web/static/style.css",
|
||||
"/web/static/adreena.css",
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 28 KiB |
@ -101,41 +101,6 @@ div .date {
|
||||
color:white;
|
||||
}
|
||||
|
||||
.gb-modal {
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
background-color: rgb(0,0,0);
|
||||
background-color: rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
.gb-modal-content {
|
||||
background-color: #fefefe;
|
||||
color: black;
|
||||
margin: 15% auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #888;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.close {
|
||||
color: #aaa;
|
||||
float: right;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.close:hover,
|
||||
.close:focus {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.friend-frame {
|
||||
width: 290px;
|
||||
height: 200px;
|
||||
|
Loading…
Reference in New Issue
Block a user