-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e58830b
commit 11dbc97
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
go install github.com/cespare/reflex@latest | ||
reflex -s -g reflex.conf -- reflex -c reflex.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# pushd examples/infinity-scrolling | ||
|
||
# if [ -e ./bin/on_reload.sh ] | ||
# then | ||
# ./bin/on_reload.sh | ||
# fi | ||
|
||
go run main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net/http" | ||
"net/url" | ||
|
||
"github.com/admin-golang/admin" | ||
"github.com/admin-golang/admin/icon" | ||
"github.com/admin-golang/admin/layout" | ||
) | ||
|
||
func NewSubscribeFormPage() (admin.Pager, error) { | ||
sideFormBackgroundImage, err := url.Parse("https://source.unsplash.com/random/?golang") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return admin.NewSideFormPage(admin.SideFormPageConfig{ | ||
BackgroundImage: sideFormBackgroundImage, | ||
PageConfig: admin.PageConfig{ | ||
Icon: icon.Icon{ | ||
Type: icon.Email, | ||
}, | ||
IsDefault: true, | ||
ID: "Subscribe", | ||
URL: "/subscribe", | ||
Type: admin.SideFormPage, | ||
}, | ||
Form: admin.Form{ | ||
ID: "subscribe", | ||
Fields: admin.Fields{ | ||
admin.Field{ | ||
ID: "email", | ||
Type: admin.InputText, | ||
Label: "Email", | ||
IsRequired: true, | ||
Value: "", | ||
FullWidth: true, | ||
}, | ||
}, | ||
Submit: admin.Submit{ | ||
Label: "Subscribe", | ||
URL: "/subscribe", | ||
Method: "POST", | ||
}, | ||
}, | ||
}), nil | ||
} | ||
|
||
func main() { | ||
subscribeFormPage, err := NewSubscribeFormPage() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
pages := admin.Pages{ | ||
subscribeFormPage, | ||
} | ||
|
||
admin := admin.New(&admin.Config{ | ||
DebugMode: false, | ||
UITheme: admin.MaterialUI, | ||
Pages: pages, | ||
Layout: layout.New(&layout.Config{}), | ||
}) | ||
|
||
mux := http.NewServeMux() | ||
|
||
mux.Handle("/", admin) | ||
|
||
log.Println("[admin-golang] running on port :8080 path: /admin") | ||
log.Fatal(http.ListenAndServe(":8080", mux)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-sr '(.go$)|(.tsx$)' -- ./bin/watch.sh |