R/bulma-align.R

Defines functions bulma_text_align bulma_align

Documented in bulma_align bulma_text_align

#' @title
#' Bulma Alignment Modifier
#'
#' @description
#' These functions change the alignment of the text inside a container.
#'
#' @param tag   (tag) to be modified
#' @param align (string) `left`, `right`, or `centered`
#'
#' @family Bulma Modifiers
#' @export
bulma_align <- function(tag, align = c("left", "right", "centered")) {

  align <- match_arg(align)
  bulma_is(tag, align)

}

#' @describeIn bulma_align text alignment
#'
#' @param align      (str) alignment of the text
#' @param breakpoint (str) breakpoint applicable
#' @param tag        (tag) tag to be modified
#'
#' @export
bulma_text_align <- function(tag,
                             align = c("left", "centered",
                                       "justified", "right"),
                             breakpoint = c("mobile", "touch", "tablet-only",
                                            "tablet", "desktop-only",
                                            "desktop", "widescreen-only",
                                            "widescreen", "fullhd")) {

  align <- match_arg(align)
  breakpoint <- match_arg(breakpoint)

  if (!is.null(breakpoint)) {
    bulma_has_text(tag, glue("{align}-{breakpoint}"))
  } else {
    bulma_has_text(tag, align)
  }

}
tjpalanca/bulma.R documentation built on Dec. 23, 2021, 10:58 a.m.