52 lines
1.7 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 is-fluid">
<section class="section">
<div class="level is-mobile">
<div class="level-left">
<h1 class="title is-size-1"><span class="has-text-info-light">Clear</span><span>Case</span></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>
<div class="tabs is-large is-fullwidth is-boxed">
<ul>
<li class={ templ.KV("is-active", MatchPath(ctx, "/issue/")) }><a href={ BaseURL(ctx, WithPath("/issue")) }><span class="icon"><i class="fa fa-plus"></i></span>Nouvelle demande</a></li>
// <li><a href={ BaseURL(ctx, WithPath("/issue")) }><span class="icon"><i class="fa fa-edit"></i></span>Éditer une demande</a></li>
<li class={ templ.KV("is-active", MatchPath(ctx, "/pullrequest/")) }><a href={ CurrentURL(ctx, WithPath("/pullrequest")) }><span class="icon"><i class="fas fa-code-branch"></i></span>Éditer une PR</a></li>
</ul>
</div>
{ children... }
</section>
</div>
}
}