rstudio / shiny

Easy interactive web applications with R
https://shiny.posit.co/
Other
5.36k stars 1.87k forks source link

icon() can't use FontAwesome 5 font styles #2263

Open AshesITR opened 5 years ago

AshesITR commented 5 years ago

https://github.com/rstudio/shiny/blob/5e2b40d3a92ea602d7187dafe49eba0d1e220cde/R/bootstrap.R#L1520-L1560

The new FontAwesome version has font classes far and fal (Most of them are pro-only, but some are free, such as check-circle or address-book in regular styling)

Using them requires a different prefix_class, but this can't be changed at the moment. Adding far or fal to class (icon("check-circle", class = "far")) doesn't work either because fa comes first.

I would code a PR for this but I wand to know what solution you prefer?

  1. Add a new argument (non-functional for glyphicon) icon <- function(name, class = NULL, lib = "font-awesome", style = c("normal", "regular", "light")) wich is ignored for glyphicon
  2. Add new options for lib ("font-awesome-regular" and "font-awesome-light", maybe?)
  3. Be smart about class containing these special classes

I kind of prefer the first option because of code clarity, but the third has the advantage of not adding a lib-specific argument to icon().

jcheng5 commented 5 years ago

I actually wouldn't mind 3. We're trying not to bend the icon API too strongly in the direction of any particular version of FontAwesome, since they changed so drastically between 4 and 5 and might do so again the next time they do a major release. Actually I'm arguing for freezing the FontAwesome support in Shiny, and delegating the responsibility to a package like https://github.com/ropenscilabs/icon.

AshesITR commented 5 years ago

@jcheng5 Did you have time to review the PR yet?