-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
grid-item.R
54 lines (54 loc) · 1.52 KB
/
grid-item.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#' Construct an item to be contained by CSS grid layout
#'
#' @param row_start,row_end,row,column_start,column_end,column,area
#' CSS properties of `gird-*`, whereas `grid-` is abbreviated, and hyphens are
#' replaced by underscores. For example, the `row_start` argument is equivalent
#' to the CSS's `grid-row-start` property. Specify a string as a value for the
#' corresponding CSS property.
#' @param col
#' An alias of column
#' @param justify_self,align_self
#' Strings to specify values for the CSS's
#' [`justify-self`](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self)
#' and
#' [`align-self`](https://developer.mozilla.org/en-US/docs/Web/CSS/align-self)
#' properties.
#' @param z_index,order
#' A string to specify the corresponding CSS property (`z-index` and `order`,
#' respectively)
#' @inheritParams grid_layout
#'
#' @export
grid_item <- function(
...,
row_start = NULL,
row_end = NULL,
row = NULL,
column_start = NULL,
column_end = NULL,
col = NULL,
column = col,
area = NULL,
justify_self = NULL,
align_self = NULL,
z_index = NULL,
order = NULL,
style = NULL
) {
div(
...,
style = collapse(construct_style(
"grid-row-start" = row_start,
"grid-row-end" = row_end,
"grid-row" = row,
"grid-column-start" = column_start,
"grid-column-end" = column_end,
"grid-column" = col,
"grid-area" = area,
"justify-self" = justify_self,
"align-self" = align_self,
"z-index" = z_index,
order = order
), style)
)
}