9 changed files with 126 additions and 20 deletions
@ -0,0 +1,36 @@
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
####### gui ####### Copyright (c) 2021 mls-361 #########g############################################ MIT License ####### |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
|
||||
package gui |
||||
|
||||
import ( |
||||
"net/http" |
||||
|
||||
"forge.chapril.org/armen/armen/internal/components" |
||||
) |
||||
|
||||
type gui struct { |
||||
storage components.Storage |
||||
} |
||||
|
||||
func newGUI(ccs *components.Components) *gui { |
||||
return &gui{ |
||||
storage: ccs.Storage, |
||||
} |
||||
} |
||||
|
||||
func Build(ccs *components.Components) { |
||||
gui := newGUI(ccs) |
||||
router := ccs.Router |
||||
|
||||
router.Get("/", http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
||||
_ = gui.Home().Render(w) |
||||
})) |
||||
} |
||||
|
||||
/* |
||||
######################################################################################################## @(°_°)@ ####### |
||||
*/ |
@ -0,0 +1,25 @@
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
####### gui ####### Copyright (c) 2021 mls-361 ##################################################### MIT License ####### |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
|
||||
package gui |
||||
|
||||
import ( |
||||
g "github.com/maragudk/gomponents" |
||||
. "github.com/maragudk/gomponents/html" |
||||
) |
||||
|
||||
func (gui *gui) Home() g.Node { |
||||
return gui.page( |
||||
"home", |
||||
P( |
||||
g.Text("Hello"), |
||||
), |
||||
) |
||||
} |
||||
|
||||
/* |
||||
######################################################################################################## @(°_°)@ ####### |
||||
*/ |
@ -0,0 +1,32 @@
|
||||
/* |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
####### gui ####### Copyright (c) 2021 mls-361 ##################################################### MIT License ####### |
||||
------------------------------------------------------------------------------------------------------------------------ |
||||
*/ |
||||
|
||||
package gui |
||||
|
||||
import ( |
||||
g "github.com/maragudk/gomponents" |
||||
c "github.com/maragudk/gomponents/components" |
||||
. "github.com/maragudk/gomponents/html" |
||||
) |
||||
|
||||
func (gui *gui) page(title string, content g.Node) g.Node { |
||||
return c.HTML5( |
||||
c.HTML5Props{ |
||||
Title: title, |
||||
Language: "en", |
||||
Head: []g.Node{ |
||||
Link(Rel("stylesheet"), Href("https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"), Type("text/css")), |
||||
}, |
||||
Body: []g.Node{ |
||||
content, |
||||
}, |
||||
}, |
||||
) |
||||
} |
||||
|
||||
/* |
||||
######################################################################################################## @(°_°)@ ####### |
||||
*/ |
Loading…
Reference in new issue