Skip to content

Commit d43e5b7

Browse files
sharing examples chapter 08 (#23)
Co-authored-by: Jon Harmon <[email protected]>
1 parent c0d942e commit d43e5b7

File tree

262 files changed

+30440
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+30440
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# devtools::install_github("RinteRface/shinybulma")
2+
3+
library(shiny)
4+
library(shinybulma)
5+
6+
shinyApp(
7+
ui = bulmaPage(
8+
bulmaSection(
9+
bulmaTileAncestor(
10+
bulmaTileParent(
11+
vertical = TRUE,
12+
bulmaTileChild(
13+
bulmaTitle("Tile 1"),
14+
p("Put some data here"),
15+
color = "link"
16+
),
17+
bulmaTileChild(
18+
bulmaTitle("Tile 2"),
19+
"Hi Bulma!",
20+
color = "danger"
21+
)
22+
),
23+
bulmaTileParent(
24+
vertical = TRUE,
25+
bulmaTileChild(
26+
bulmaTitle("Tile 3"),
27+
p("Put some data here"),
28+
color = "warning"
29+
),
30+
bulmaTileChild(
31+
bulmaTitle("Tile 3"),
32+
("Put some data here"),
33+
color = "info"
34+
)
35+
)
36+
)
37+
)
38+
),
39+
server = function(input, output) {}
40+
)
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# devtools::install_github("RinteRface/shinybulma")
2+
3+
library(shiny)
4+
library(sass)
5+
library(shinybulma)
6+
7+
css <- sass(
8+
sass_layer(
9+
defaults = list(
10+
turquoise = "#03a4ff",
11+
cyan = "#e705be",
12+
green = "#f3d6e9",
13+
yellow = "#fdaf2c",
14+
red = "#ff483e",
15+
"scheme-main" = "hsl(0, 0%, 10%)"
16+
),
17+
rules = sass_file(
18+
input = "examples/chapter-08/bulma/bulma.sass"
19+
)
20+
)
21+
)
22+
23+
shinyApp(
24+
ui = bulmaPage(
25+
tags$head(tags$style(css)),
26+
bulmaSection(
27+
bulmaTileAncestor(
28+
bulmaTileParent(
29+
vertical = TRUE,
30+
bulmaTileChild(
31+
bulmaTitle("Tile 1"),
32+
p("Put some data here"),
33+
color = "link"
34+
),
35+
bulmaTileChild(
36+
bulmaTitle("Tile 2"),
37+
"Hi Bulma!",
38+
color = "danger"
39+
)
40+
),
41+
bulmaTileParent(
42+
vertical = TRUE,
43+
bulmaTileChild(
44+
bulmaTitle("Tile 3"),
45+
p("Put some data here"),
46+
color = "warning"
47+
),
48+
bulmaTileChild(
49+
bulmaTitle("Tile 3"),
50+
("Put some data here"),
51+
color = "info"
52+
)
53+
)
54+
)
55+
)
56+
),
57+
server = function(input, output) {}
58+
)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
library(shiny)
2+
library(bs4Dash)
3+
4+
ui <- dashboardPage(
5+
dashboardHeader(title = "Custom colors"),
6+
dashboardSidebar(),
7+
dashboardBody(
8+
# Boxes need to be put in a row (or column)
9+
fluidRow(
10+
box(
11+
solidHeader = TRUE,
12+
plotOutput("plot1", height = 250),
13+
status = "olive"
14+
),
15+
box(
16+
solidHeader = TRUE,
17+
status = "lightblue",
18+
title = "Controls",
19+
sliderInput(
20+
"slider",
21+
"Number of observations:",
22+
1,
23+
100,
24+
50
25+
)
26+
)
27+
)
28+
)
29+
)
30+
31+
server <- function(input, output) {
32+
set.seed(122)
33+
histdata <- rnorm(500)
34+
35+
output$plot1 <- renderPlot({
36+
data <- histdata[seq_len(input$slider)]
37+
hist(data)
38+
})
39+
}
40+
41+
shinyApp(ui, server)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
library(shiny)
2+
library(sass)
3+
library(bs4Dash)
4+
5+
css <- sass(
6+
sass_layer(
7+
defaults = list(
8+
lightblue = "#136377",
9+
olive = "#d8bc66",
10+
lime = "#fcec0c",
11+
orange = "#978d01",
12+
maroon = "#58482c",
13+
"gray-x-light" = "#d1c5c0"
14+
),
15+
rules = sass_file(
16+
input = "examples/chapter-08/adminlte/adminlte.scss"
17+
)
18+
)
19+
)
20+
21+
22+
ui <- dashboardPage(
23+
dashboardHeader(title = "Custom colors"),
24+
dashboardSidebar(),
25+
dashboardBody(
26+
tags$head(tags$style(css)),
27+
# Boxes need to be put in a row (or column)
28+
fluidRow(
29+
box(
30+
solidHeader = TRUE,
31+
plotOutput("plot1", height = 250),
32+
status = "olive"
33+
),
34+
box(
35+
solidHeader = TRUE,
36+
status = "lightblue",
37+
title = "Controls",
38+
sliderInput(
39+
"slider",
40+
"Number of observations:",
41+
1,
42+
100,
43+
50
44+
)
45+
)
46+
)
47+
)
48+
)
49+
50+
server <- function(input, output) {
51+
set.seed(122)
52+
histdata <- rnorm(500)
53+
54+
output$plot1 <- renderPlot({
55+
data <- histdata[seq_len(input$slider)]
56+
hist(data)
57+
})
58+
}
59+
60+
shinyApp(ui, server)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
library(shiny)
2+
library(bs4Dash)
3+
library(fresh)
4+
5+
custom_colors_theme <- create_theme(
6+
bs4dash_color(
7+
lightblue = "#136377",
8+
olive = "#d8bc66",
9+
lime = "#fcec0c",
10+
orange = "#978d01",
11+
maroon = "#58482c",
12+
gray_x_light = "#d1c5c0"
13+
)
14+
)
15+
16+
17+
ui <- dashboardPage(
18+
freshTheme = custom_colors_theme,
19+
dashboardHeader(title = "Custom colors"),
20+
dashboardSidebar(),
21+
dashboardBody(
22+
# Boxes need to be put in a row (or column)
23+
fluidRow(
24+
box(
25+
solidHeader = TRUE,
26+
plotOutput("plot1", height = 250),
27+
status = "olive"
28+
),
29+
box(
30+
solidHeader = TRUE,
31+
status = "lightblue",
32+
title = "Controls",
33+
sliderInput(
34+
"slider",
35+
"Number of observations:",
36+
1,
37+
100,
38+
50
39+
)
40+
)
41+
)
42+
)
43+
)
44+
45+
server <- function(input, output) {
46+
set.seed(122)
47+
histdata <- rnorm(500)
48+
49+
output$plot1 <- renderPlot({
50+
data <- histdata[seq_len(input$slider)]
51+
hist(data)
52+
})
53+
}
54+
55+
shinyApp(ui, server)

0 commit comments

Comments
 (0)