Code Reuse


fun BODY.sideNavBar(block: UL.() -> Unit) = div { 
  classes += "navBar"
  style = css { 
    verticalAlign = VerticalAlign.top
  }
  ul { 
    style = css { 
      listStyleType = ListStyleType.none
      color = Color("#9999EE")
    }
    block(this)
  }
}



fun BODY.sideNav() { 
  sideNavBar { 
    li {  a(href = "index.html") {  +"Home" } }
    li {  a(href = "travel.html") {  +"Travel Guide" } }
  }
}


fun mainPage() : HTML.() -> Unit = { 
  head { 
  }
  body { 
    sideNav()
  }
}


Back Home Next