Created
February 28, 2015 21:30
-
-
Save japgolly/78507c5953d8f848f63c to your computer and use it in GitHub Desktop.
Basic bootstrap NavBar model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// In Link & MenuItem, when onClick is None it means it should be disabled. | |
// This enforces the invariant that disabled items cannot be clicked. | |
// If you want something clickable but you want it to do nothing then pass it | |
// a callback that does nothing: Some(IO(())) | |
sealed trait NavItem | |
case class Link(label: String, onClick: Option[IO[Unit]], active: Boolean) extends NavItem | |
case class DropdownMenu(items: NonEmptyList[MenuItem]) extends NavItem | |
sealed trait MenuItem | |
case object MenuDivider extends MenuItem | |
case class MenuEntry(label: String, onClick: Option[IO[Unit]]) extends MenuItem | |
case class NavBarProps(items: NonEmptyList[NavItem], disableEverything: Boolean) | |
val NavBar = | |
ReactComponentB[NavBarProps]("NavBar") | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment