Skip to content

Commit

Permalink
some bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Oct 19, 2018
1 parent b4a0178 commit dbd8d39
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 31 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ export(argonSection)
export(argonTab)
export(argonTabSet)
export(argonTextColor)
export(argonTooltip)
export(argonUser)
2 changes: 1 addition & 1 deletion R/argonButton.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ argonButton <- function(name = NULL, status = "default", icon = NULL,
type = "button",
disabled = if (disabled) NA else NULL,
`data-toggle` = if (toggle_modal) "modal" else NULL,
`data-target` = if (toggle_modal) modal_id else NULL,
`data-target` = if (toggle_modal) paste0("#", modal_id) else NULL,
if (!is.null(icon)) {
if (!is.null(name)) {
htmltools::tagList(
Expand Down
4 changes: 2 additions & 2 deletions R/argonModal.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ argonModal <- function(..., id, title = NULL, status = NULL, gradient = FALSE) {
class="btn btn-secondary",
`data-dismiss` = "modal",
"Close"
),
argonButton(name = "Ok", status = "primary")
)#,
#argonButton(name = "Ok", status = "primary")
)

# content
Expand Down
7 changes: 4 additions & 3 deletions R/argonPagination.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#' if(interactive()){
#' library(argonR)
#' }
#'
#' @note align will not work if you embed the argonPagination in an argonRow.
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
Expand All @@ -27,8 +29,7 @@ argonPagination <- function(..., size = NULL, align = NULL) {
)
}
htmltools::tags$li(
class="page-item",
active = if (i == 1) NA else NULL,
class = if (i == 1) "page-item active" else "page-item",
items[[i]]
)
})
Expand Down Expand Up @@ -61,7 +62,7 @@ argonPagination <- function(..., size = NULL, align = NULL) {

htmltools::tags$nav(
`aria-label` = "Page navigation example",
htmltools::tags$div(
htmltools::tags$ul(
class = paginationCl,
prevBttn,
paginationItems,
Expand Down
64 changes: 50 additions & 14 deletions R/typography.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ argonTextColor <- function(tag, color) {
#' argonMargin(tag = h1("test"), orientation = "x", value = 7)
#' }
#'
#' @note Disabled on small screens (not a bug)
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
Expand All @@ -167,8 +165,6 @@ argonMargin <- function(tag, orientation, value) {
#' argonPadding(tag = h1("test"), orientation = "x", value = 2)
#' }
#'
#' @note Disabled on small screens (not a bug)
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
Expand All @@ -191,8 +187,6 @@ argonPadding <- function(tag, orientation, value) {
#'
#' }
#'
#' @note Disabled on small screens (not a bug)
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
Expand All @@ -205,12 +199,54 @@ argonContainer <- function(..., size = NULL) {




#' Create a boostrap 4 tooltip
#'
#' @param tag Tag to be documented.
#' @param position Where to display the toolptip: "top", "right", "bottom" or "left".
#' @param title Tooltip title.
#'
#' @examples
#' if (interactive()) {
#' library(argonR)
#'
#' }
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#'
#' @export
argonTooltip <- function(tag, position, title = NULL) {
len_attr <- length(tag$attribs)
#tag$attribs[[len_attr + 1]] <- '`data-toggle` = "tooltip"'
#tag$attribs[[len_attr + 2]] <- paste0('`data-placement` = ', position)
#tag$attribs[[len_attr + 3]] <- paste0('title = ', title)
#tag
len_attr
}
# add tooltip attributes to the tag
tag$attribs[["data-toggle"]] <- "tooltip"
tag$attribs[["data-placement"]] <- position
tag$attribs[["title"]] <- title
return(tag)
}



# #' Create a boostrap 4 code container
# #'
# #' @param ... Any code
# #' @param language Code language.
# #'
# #' @examples
# #' if (interactive()) {
# #' library(argonR)
# #'
# #' }
# #'
# #' @author David Granjon, \email{dgranjon@@ymail.com}
# #'
# #' @export
# argonCode <- function(..., language = NULL) {
# htmltools::tags$div(
# class = "highlight",
# #htmltools::tags$pre(
# htmltools::tags$code(
# class = paste0("language-", language),
# `data-lang` = language,
# ...
# )
# #)
# )
# }#
64 changes: 62 additions & 2 deletions inst/examples/example.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This examples show how to create a simple static html page using aronR

library(argonR)
library(htmltools)
library(magrittr)

example <- argonPage(
title = "Argon Static Template",
Expand Down Expand Up @@ -184,7 +186,65 @@ example <- argonPage(
)
)
) %>% argonMargin(orientation = "t", value = -200)
%>% argonPadding(orientation = "t", value = 0)
%>% argonPadding(orientation = "t", value = 0),
argonSection(
size = "lg",
status = "warning",
gradient = TRUE,
separator = TRUE,
separator_color = "secondary",
shape = FALSE,
argonContainer(
size = "lg",
argonRow(
argonColumn(
width = 6,
argonH1(
display = 3,
"Load modals",
htmltools::span("by clicking on buttons")
) %>% argonTextColor(color = "white"),
argonButton(
name = "Click me!",
status = "danger",
icon = "atom",
size = "lg",
toggle_modal = TRUE,
modal_id = "modal1"
)
),
argonColumn(
width = 6,
argonModal(
id = "modal1",
title = "This is a modal",
status = "danger",
gradient = TRUE,
"YOU SHOULD READ THIS!",
br(),
"A small river named Duden flows by their place and supplies it with the necessary regelialia."
),
argonImage(
floating = TRUE,
src = "https://demos.creative-tim.com/argon-design-system/assets/img/ill/ill-2.svg",
hover_lift = TRUE
) %>% argonTooltip(position = "right", title = "I am a nice floating image")
)
) %>% argonPadding(orientation = "y", value = 5),
argonPagination(
size = "lg",
align = "center",
argonPaginationItem(
name = 1,
src = "test.html"
),
argonPaginationItem(
name = 2,
src = "https://www.google.com"
)
)
)
)
)


Expand Down
3 changes: 0 additions & 3 deletions man/argonContainer.Rd

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

3 changes: 0 additions & 3 deletions man/argonMargin.Rd

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

3 changes: 0 additions & 3 deletions man/argonPadding.Rd

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

3 changes: 3 additions & 0 deletions man/argonPagination.Rd

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

28 changes: 28 additions & 0 deletions man/argonTooltip.Rd

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

0 comments on commit dbd8d39

Please sign in to comment.