flipBox: AdminLTE2 flipping box

Description Usage Arguments Author(s) Examples

View source: R/boxes.R

Description

Create a flipping box

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
flipBox(
  ...,
  back_content,
  id,
  front_title = NULL,
  back_title = NULL,
  front_btn_text = "More",
  back_btn_text = "Back to main",
  header_img = NULL,
  main_img = NULL,
  width = 6
)

Arguments

...

front body content.

back_content

back body content.

id

Box id. Must be unique!

front_title

Box front title.

back_title

Box back title.

front_btn_text

Front button text.

back_btn_text

Back button text.

header_img

Header background image url or path.

main_img

Main image url or path (for instance profile image).

width

box width (between 1 and 12). 6 by default.

Author(s)

David Granjon, dgranjon@ymail.com

Examples

  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
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
if (interactive()) {
 library(shiny)
 library(shinydashboard)
 library(shinydashboardPlus)
 shinyApp(
   ui = dashboardPage(
     dashboardHeader(),
     dashboardSidebar(),
     dashboardBody(
       setShadow("card"),
       fluidRow(
         column(
           width = 6,
           align = "center",
           flipBox(
             id = 1,
             main_img = "https://image.flaticon.com/icons/svg/149/149076.svg",
             header_img = "https://image.flaticon.com/icons/svg/119/119595.svg",
             front_title = "John Doe",
             back_title = "About John",
             "Lorem ipsum dolor sit amet, consectetur adipiscing elit, 
             sed do eiusmod tempor incididunt ut labore et dolore magna 
             aliqua. Ut enim ad minim veniam, quis nostrud exercitation 
             ullamco laboris nisi ut aliquip ex ea commodo consequat. 
             Duis aute irure dolor in reprehenderit in voluptate velit 
             esse cillum dolore eu fugiat nulla pariatur. Excepteur sint 
             occaecat cupidatat non proident, sunt in culpa qui officia 
             deserunt mollit anim id est laborum",
             fluidRow(
               dashboardLabel("Label 1", status = "info"),
               dashboardLabel("Label 2", status = "success"),
               dashboardLabel("Label 3", status = "warning"),
               dashboardLabel("Label 4", status = "primary"),
               dashboardLabel("Label 5", status = "danger")
             ),
             hr(),
             fluidRow(
               column(
                 width = 6,
                 align = "center",
                 starBlock(grade = 5),
                 starBlock(grade = 5, color = "olive"),
                 starBlock(grade = 1, color = "maroon"),
                 starBlock(grade = 3, color = "teal")
               ),
               column(
                 width = 6,
                 align = "center",
                 appButton(
                   url = "https://google.com",
                   label = "Users",
                   icon = "fa fa-users",
                   enable_badge = TRUE,
                   badgeColor = "purple",
                   badgeLabel = 891
                 ),
                 appButton(
                   label = "Edit",
                   icon = "fa fa-edit",
                   enable_badge = FALSE,
                   badgeColor = NULL,
                   badgeLabel = NULL
                 )
               )
             ),
             back_content = tagList(
               column(
                 width = 12,
                 align = "center",
                 sliderInput(
                   "obs", 
                   "Number of observations:",
                   min = 0, 
                   max = 1000, 
                   value = 500
                 )
               ),
               plotOutput("distPlot")
             )
           )
       ),
       column(
         width = 6,
         align = "center",
         flipBox(
           id = 2,
           main_img = "https://image.flaticon.com/icons/svg/149/149073.svg",
           header_img = "https://image.flaticon.com/icons/svg/119/119598.svg",
           front_title = "Johanna Doe",
           back_title = "About Johanna",
           fluidRow(
             column(
               width = 6,
               align = "center",
               boxPad(
                 color = "green",
                 descriptionBlock(
                   header = "8390",
                   text = "VISITS",
                   right_border = FALSE,
                   margin_bottom = TRUE
                 ),
                 descriptionBlock(
                   header = "30%",
                   text = "REFERRALS",
                   right_border = FALSE,
                   margin_bottom = TRUE
                 ),
                 descriptionBlock(
                   header = "70%",
                   text = "ORGANIC",
                   right_border = FALSE,
                   margin_bottom = FALSE
                 )
               )
             ),
             column(
               width = 6,
               align = "center",
               "Lorem ipsum dolor sit amet, consectetur adipiscing elit, 
               sed do eiusmod tempor.",
               br(),
               verticalProgress(
                 value = 10,
                 striped = TRUE,
                 active = TRUE
               ),
               verticalProgress(
                 value = 50,
                 active = TRUE,
                 status = "warning",
                 size = "xs"
               ),
               verticalProgress(
                 value = 20,
                 status = "danger",
                 size = "sm",
                 height = "60%"
               )
             )
           ),
           back_content = tagList(
             column(
               width = 12,
               align = "center",
               radioButtons(
                 "dist", 
                 "Distribution type:",
                 c("Normal" = "norm",
                   "Uniform" = "unif",
                   "Log-normal" = "lnorm",
                   "Exponential" = "exp"
                 )
               )
             ),
             plotOutput("plot")
           )
       )
       )
     )
   ),
   title = "flipBox"
   ),
   server = function(input, output) {
     output$distPlot <- renderPlot({
       hist(rnorm(input$obs))
     })
     output$plot <- renderPlot({
       dist <- switch(input$dist,
                      norm = rnorm,
                      unif = runif,
                      lnorm = rlnorm,
                      exp = rexp,
                      rnorm)
       
       hist(dist(500))
     })
   }
  )
}

dsciencelabs/shinydashboardPlus documentation built on Dec. 20, 2021, 2:10 a.m.