Skip to content

Commit

Permalink
fix(r): margin prefix, height default method, background dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
nteetor committed Mar 14, 2020
1 parent 4e17abc commit 97af15d
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 29 deletions.
2 changes: 2 additions & 0 deletions R/design-background.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#'
#' @eval param_color("background")
#'
#' @includeRmd man/roxygen/background-inputs.Rmd
#'
#' @family design utilities
#' @export
#' @examples
Expand Down
3 changes: 1 addition & 2 deletions R/design-sizing.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ height.shiny.tag <- function(x, size) {

#' @export
height.default <- function(x, size) {
# abort("No method implemented for ", class(x))
abort_design_default()
tag_class_add(x, height_size(size))
}

height_size <- function(size) {
Expand Down
6 changes: 3 additions & 3 deletions R/design-spacing.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ margin_top <- function(top) {
top <- lapply(top, margin_negative)
top <- resp_construct(top, c(0:5, "auto", "n1", "n2", "n3", "n4", "n5"))

sprintf("p%s", resp_classes(top, "t"))
sprintf("m%s", resp_classes(top, "t"))
}

margin_right <- function(right) {
Expand All @@ -255,7 +255,7 @@ margin_right <- function(right) {
right <- lapply(right, margin_negative)
right <- resp_construct(right, c(0:5, "auto", "n1", "n2", "n3", "n4", "n5"))

sprintf("p%s", resp_classes(right, "r"))
sprintf("m%s", resp_classes(right, "r"))
}

margin_bottom <- function(bottom) {
Expand All @@ -266,7 +266,7 @@ margin_bottom <- function(bottom) {
bottom <- lapply(bottom, margin_negative)
bottom <- resp_construct(bottom, c(0:5, "auto", "n1", "n2", "n3", "n4", "n5"))

sprintf("p%s", resp_classes(bottom, "b"))
sprintf("m%s", resp_classes(bottom, "b"))
}

margin_left <- function(left) {
Expand Down
4 changes: 3 additions & 1 deletion R/list-group.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ listGroupInput <- function(..., id, choices = NULL, values = choices,

items <- map_listitems(choices, values, selected)

args <- style_dots_eval(..., .style = style_pronoun("yonder_list_group"))

tag <- div(
class = str_collate(
"yonder-list-group",
Expand All @@ -133,7 +135,7 @@ listGroupInput <- function(..., id, choices = NULL, values = choices,
),
id = id,
items,
...
!!!args
)

s3_class_add(tag, c("yonder_list_group", "yonder_input"))
Expand Down
15 changes: 15 additions & 0 deletions R/utils-dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ dep_complete <- function() {
flag_set("deps", NULL)
}

dep_skip <- function() {
opt <- getOption("yonder.deps", TRUE)

is_false(opt) || is_na(opt)
}

dep_attach <- function(tag) {
if (dep_skip()) {
return(tag)
}

deps <- dep_fetch()

if (!is.null(deps)) {
Expand All @@ -33,6 +43,11 @@ dep_attach <- function(tag) {
}
}

dep_remove <- function(tag) {
attr(tag, "html_dependecies") <- NULL
tag
}

with_deps <- function(expr) {
dep_attach(expr)
}
Expand Down
17 changes: 7 additions & 10 deletions R/yonder.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,21 @@ NULL
#' Yonder is a set of tools for flexible and creative shiny application
#' construction and design.
#'
#' @section Inputs:
#' @section Getting started:
#'
#' ## Inputs
#'
#' Yonder provides many familiar inputs like [selectInput()] or [radioInput()].
#' There are also new inputs like [groupTextInput()] or [formInput()].
#'
#' **Changes to be mindful of**
#'
#' * Input functions have an `id` argument instead of `inputId`.
#'
#' * Input functions do not include a `label` argument for the purpose of adding
#' a label above the input. Button and menu inputs do include a `label`
#' argument, but these arguments refer to button labels. If you would like to
#' add a label above an input please use [formGroup()].
#'
#' **Familiar variants**
#'
#' Looking for ... ?
#' ### Looking for ... ?
#'
#' * `actionButton()` or `actionLink()` use [buttonInput()] or [linkInput()]
#'
Expand All @@ -42,15 +40,13 @@ NULL
#'
#' * `submitButton()` use [formInput()] and [formSubmit()]
#'
#' @section Layout and content:
#' ## Layout and content
#'
#' Included are a handful of utilities for building applications suited for
#' devices and screens of varying sizes. For real control over spacing elements
#' be sure to check out [flex()], which gives you the power of flexbox layout.
#'
#' **Familiar variants**
#'
#' Looking for ... ?
#' ### Looking for ... ?
#'
#' * `fluidRow()` or `fixedRow()` use [columns()]
#'
Expand All @@ -63,4 +59,5 @@ NULL
#'
#' * `modalDialog()` use [modal()]
#'
#' @name yonder
"_PACKAGE"
51 changes: 51 additions & 0 deletions man/background.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 10 additions & 13 deletions man/yonder-package.Rd → man/yonder.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 97af15d

Please sign in to comment.