Code for Table
library(reactablefmtr)
library(htmltools)
library(dplyr)
library(nflfastR)
data <- read.csv("nfldraftorder.csv", check.names = FALSE)
table_theme <- function() {
reactable::reactableTheme(
style = list(fontFamily = "Courier New", fontSize = "16px"),
headerStyle = list(
"&:hover[aria-sort]" = list(
background = "hsl(0, 0%, 80%)"),
"&[aria-sort='ascending'], &[aria-sort='descending']" = list(
background = "#eaeaea", color = "#333"),
borderColor = "#333")
)}
table <- data %>%
reactable(.,
theme = table_theme,
columnGroups = list(colGroup(
name = "Round",
columns = c("1", "2", "3", "4", "5", "6", "7"),
headerStyle = list(fontSize = "18px"))),
defaultSorted = "Total",
defaultSortOrder = "desc",
pagination = FALSE,
defaultColDef = colDef(
headerStyle = list(fontSize = "18px"),
maxWidth = 60, align = "center",
cell = color_tiles(.,
colors = c("lightpink", "white", "#d9f0d3", "#7fbf7b", "#1b7837"),
span = 4:10),
style = list(borderRight = "1px solid #bebebe")),
columns = list(
team_color = colDef(show = FALSE),
team_logo_espn = colDef(show = FALSE),
team_abbr = colDef(name = "Tm"),
Total = colDef(
maxWidth = 400, name = "Total Picks",
cell = data_bars(.,
text_position = "outside-end",
fill_color_ref = "team_color", fill_opacity = 0.7, max_value = 12,
img_ref = "team_logo_espn", img_height = 38, img_width = 38),
style = list(borderRight = "0px")))
)
div(class = "title",
div(
"Table last updated on", format(Sys.Date(), "%b %d %Y"),
table,
"Source: https://www.espn.com/nfl/")
)
.title {
font-family: "Courier New";
font-size: 18px;
}