45 lines
1.0 KiB
Plaintext
45 lines
1.0 KiB
Plaintext
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>
|
|
}
|
|
}
|