Skip to content

Instantly share code, notes, and snippets.

@ufocoder
Created November 4, 2018 20:28
Show Gist options
  • Select an option

  • Save ufocoder/96732371e7cccfe080bf673ca7992d6b to your computer and use it in GitHub Desktop.

Select an option

Save ufocoder/96732371e7cccfe080bf673ca7992d6b to your computer and use it in GitHub Desktop.
renderRow : String -> Int -> Html Msg
renderRow title data =
tr []
[ td [] [ text title ]
, td
[ style
[ ( "text-align", "right" )
, ( "min-width", "5rem" )
]
]
[ data |> toString |> text ]
]
viewReport : LibraryReport -> Html Msg
viewReport report =
div
[ style
[ ( "background-color", "#eee" )
, ( "padding", "3px" )
, ( "margin", "3rem" )
]
]
[ b [] [ text "Library Report" ]
, table []
[ renderRow "Number of Books" report.numBooks
, renderRow "Oldest Copyright" report.oldestCopyright
, renderRow "Newest Copyright" report.newestCopyright
, renderRow "Number of Unique Authors " report.uniqueAuthors
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment