Skip to content

Commit

Permalink
Add a NavButton
Browse files Browse the repository at this point in the history
Renders a link for navigation pages
  • Loading branch information
dusty-phillips committed Feb 3, 2021
1 parent 8b2c890 commit 809689c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/NavBar.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/NavBar.res
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
module NavButton = {
@react.component
let make = (~name: string, ~selected: string, ~linkTo: string) => {
let style = if selected == name {
ReactDOM.Style.make(~backgroundColor="#656565", ~padding="1ex", ())
} else {
ReactDOM.Style.make(~backgroundColor="#efefef", ~padding="1ex", ())
}

<div style={style} onClick={_ => ReasonReactRouter.push(linkTo)}> {React.string(name)} </div>
}
}

@react.component
let make = () => {
let url = ReasonReactRouter.useUrl()
Expand Down

0 comments on commit 809689c

Please sign in to comment.