Skip to content

Instantly share code, notes, and snippets.

@busti
Created February 25, 2018 20:06
Show Gist options
  • Save busti/a883bce87f378fd2e40148d62d4a055e to your computer and use it in GitHub Desktop.
Save busti/a883bce87f378fd2e40148d62d4a055e to your computer and use it in GitHub Desktop.
object Main extends App {
val header: THeaderFactory = new HeaderWithAuthorImpl("FooBar")
val data = html(
body(
div(id := "some-div")(
header,
div(id := "content-a")
),
div(id := "some-other-div")(
header,
div(id := "content-b")
)
)
).render
}
//Those names are horrible and not exactly my usecase, this is just an example.
trait THeaderFactory {
def header: Seq[Modifier]
}
class HeaderWithAuthorImpl(author: String) extends THeaderFactory {
//I would like to get rid of the "Seq"
def header = Seq(
h1("This is some Content"),
hr()
h2("This is a Subtitle"),
br(),
h3("Written by " + author)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment