Table last updated on Apr 23 2021

Source: ESPN, Lee Sharpe



Code for Table

library(reactablefmtr)
library(htmltools)
library(dplyr)
library(nflfastR)

data <- read.csv("nfldraftorder_value.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")
  )}

trade_value_col <- colDef(maxWidth = 300,
                          cell = data_bars(data,
                                           fill_color_ref = "team_color", fill_opacity = 0.9,
                                           background = "#c6c6c6",
                                           text_position = "inside-base", 
                                           number_fmt = scales::comma))

otc_trade_value_col <- colDef(maxWidth = 300,
                          cell = data_bars(data,
                                           fill_color_ref = "team_color", fill_opacity = 0.9,
                                           background = "#c6c6c6",
                                           text_position = "inside-base", 
                                           number_fmt = scales::comma),
                          style = list(borderRight = "0px"))

table <-
  reactable(data,
    theme = table_theme,
    columnGroups = list(colGroup(
      name = "Round",
      columns = c("1", "2", "3", "4", "5", "6", "7"),
      headerStyle = list(fontSize = "18px")),
      colGroup(
        name = "Expected Trade Value",
        columns = c("Stuart","Johnson","Hill","OTC"),
        headerStyle = list(fontSize = "18px"))
      ),
    defaultSorted = "OTC",
    defaultSortOrder = "desc",
    pagination = FALSE,
    defaultColDef = colDef(
      headerStyle = list(fontSize = "18px"),
      maxWidth = 50, align = "center",
      cell = color_tiles(data,
        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 = ""),
      Total = colDef(show = FALSE),
      Stuart = trade_value_col,
      Johnson = trade_value_col,
      Hill = trade_value_col,
      OTC = otc_trade_value_col)
  )

div(class = "title",
  div("Table last updated on", format(Sys.Date(), "%b %d %Y"),
  table)
)
.title {
  font-family: "Courier New";
  font-size: 18px;
}