|
20 | 20 | #' * `NULL` |
21 | 21 | #' * Allows power users to set the `grid-template-columns` CSS property |
22 | 22 | #' manually, either via a `style` attribute or a CSS stylesheet. |
23 | | -#' @param fixed_width Whether or not to interpret the `width` as a minimum |
24 | | -#' (`fixed_width=FALSE`) or fixed (`fixed_width=TRUE`) width when it is a CSS |
25 | | -#' length unit. |
| 23 | +#' @param fixed_width When `width` is greater than 1 or is a CSS length unit, |
| 24 | +#' e.g. `"200px"`, `fixed_width` indicates whether that `width` value |
| 25 | +#' represents the absolute size of each column (`fixed_width=TRUE`) or the |
| 26 | +#' minimum size of a column (`fixed_width=FALSE`). When `fixed_width=FALSE`, |
| 27 | +#' new columns are added to a row when `width` space is available and columns |
| 28 | +#' will never exceed the container or viewport size. When `fixed_width=TRUE`, |
| 29 | +#' all columns will be exactly `width` wide, which may result in columns |
| 30 | +#' overflowing the parent container. |
26 | 31 | #' @param heights_equal If `"all"` (the default), every card in every row of the |
27 | 32 | #' grid will have the same height. If `"row"`, then every card in _each_ row |
28 | 33 | #' of the grid will have the same height, but heights may vary between rows. |
@@ -77,7 +82,10 @@ layout_column_wrap <- function( |
77 | 82 | if (fixed_width) { |
78 | 83 | paste0("repeat(auto-fit, ", validateCssUnit(width), ")") |
79 | 84 | } else { |
80 | | - paste0("repeat(auto-fit, minmax(", validateCssUnit(width), ", 1fr))") |
| 85 | + sprintf( |
| 86 | + "repeat(auto-fit, minmax(min(%s, 100%%), 1fr))", |
| 87 | + validateCssUnit(width) |
| 88 | + ) |
81 | 89 | } |
82 | 90 | } |
83 | 91 | } |
|
0 commit comments