good
good copied to clipboard
Add Goox Component System
package someComponent
type Comp struct {
GooxComponent
}
func (c *Comp) Render() GooxComponent {
return (
<div class="some-component">
{c.Childs}
</div>
)
}
package template
import "someComponent"
func Render() GooxComponent {
var s = <span>span from var</span>
return (
<someComponent.Comp>
<div class="abc" style={ GooxStyle{ Padding: 10 } }>
<p>Goox demo</p>
{s}
</div>
</someComponent.Comp>
)
}
package main
import (
"template"
"fmt"
)
func main() {
fmt.Println(template.Render())
}
should print in console:
<div class="some-component">
<div class="abc" style="padding: 10px">
<p>Goox demo</p>
<span>span from var</span>
</div>
</div>
also should be printable as a struct with fmt.Printf("%#+v", gooxcomp)
and be compatible to work with struct syntax like gooxcomp.Style.Padding
@aleksei0807 +1