feat: initial commit
This commit is contained in:
44
internal/http/handler/webui/common/component/app_page.templ
Normal file
44
internal/http/handler/webui/common/component/app_page.templ
Normal file
@ -0,0 +1,44 @@
|
||||
package component
|
||||
|
||||
type AppPageOptions struct {
|
||||
PageOptions []PageOptionFunc
|
||||
}
|
||||
|
||||
type AppPageOptionFunc func(opts *AppPageOptions)
|
||||
|
||||
func WithPageOptions(funcs ...PageOptionFunc) AppPageOptionFunc {
|
||||
return func(opts *AppPageOptions) {
|
||||
opts.PageOptions = funcs
|
||||
}
|
||||
}
|
||||
|
||||
func NewAppPageOptions(funcs ...AppPageOptionFunc) *AppPageOptions {
|
||||
opts := &AppPageOptions{
|
||||
PageOptions: make([]PageOptionFunc, 0),
|
||||
}
|
||||
for _, fn := range funcs {
|
||||
fn(opts)
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
templ AppPage(funcs ...AppPageOptionFunc) {
|
||||
{{ opts := NewAppPageOptions(funcs...) }}
|
||||
@Page(opts.PageOptions...) {
|
||||
<div class="container">
|
||||
<section class="section">
|
||||
<div class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<h1 class="title is-size-1">Kouiz</h1>
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="buttons is-right level-item">
|
||||
<a class="button is-medium" href={ BaseURL(ctx, WithPath("/auth/logout")) }><span class="icon"><i class="fa fa-sign-out-alt"></i></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{ children... }
|
||||
</section>
|
||||
</div>
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user