ソースを参照

A working dropdown-style ui; note can't use picker

Petra Lamborn 4 年 前
コミット
d581066b35
共有1 個のファイルを変更した53 個の追加29 個の削除を含む
  1. 53
    29
      MedicalCentres/app.R

+ 53
- 29
MedicalCentres/app.R ファイルの表示

@@ -10,37 +10,56 @@ DHBs <- sort(unique(Geo2017$dhb_name))
10 10
 DHBs <- c(DHBs[DHBs != "Missing"], "Missing")
11 11
 
12 12
 
13
-ui <- fluidPage(title = "New Zealand GP Practice Locations 2017",
14
-        sidebarLayout(position = "right",
15
-          sidebarPanel(width = 4,
16
-            style = "overflow-y: auto; height: 100vh; margin: 0;",
17
-            strong("Not Implemented"), hr(),
18
-            searchInput("mapsearch",
19
-                        placeholder = "Search GP practices by name",
20
-                        btnSearch = icon("search"), 
21
-                        btnReset = icon("remove"), 
22
-                        width = "100%"),
23
-            hr(),
24
-            radioButtons("selcol", "Colour by",
25
-                         choices = c("None",
26
-                                     "DHB",
27
-                                     "Snargleflagen")),
28
-            hr(),
29
-            checkboxInput("dhboverlay", "Show DHB boundaries"),
30
-            hr(),
31
-            pickerInput("dhbpicker",
32
-                        label = "Show from DHBs",
33
-                        choices = DHBs,
34
-                        multiple = TRUE,
35
-                        options = pickerOptions(size=10),
36
-                        selected = DHBs)
37
-          ),
38
-          mainPanel(width = 8,
39
-            leafletOutput(outputId = "medmap", height = "100vh")
40
-          )
41
-        )
13
+ui <- fillPage(title = "New Zealand GP Practice Locations 2017",
14
+    tags$style(type = "text/css", 
15
+               "#medmap {
16
+                 height: 100% !important;
17
+                 /*posiiton: absolute;*/
18
+                 top: 0;
19
+                 left: 0;
20
+               }
21
+               .dropdowncont {
22
+                 position: fixed;
23
+                 top: 0;
24
+                 right: 0;
25
+                 z-index: 10;
26
+               }
27
+               .dropdowncont ul {
28
+                 overflow-y: auto;
29
+                 max-height: calc(100vh - 100px);
30
+               }"),
31
+    div(class = "dropdowncont",
32
+    dropdownButton(
33
+      strong("Not Implemented"), hr(),
34
+      strong("Not Implemented"), hr(),
35
+      strong("Not Implemented"), hr(),
36
+      strong("Not Implemented"), hr(),
37
+      strong("Not Implemented"), hr(),
38
+      strong("Not Implemented"), hr(),
39
+      strong("Not Implemented"), hr(),
40
+      strong("Not Implemented"), hr(),
41
+      strong("Not Implemented"), hr(),
42
+      searchInput("mapsearch",
43
+                  placeholder = "Search GP practices by name",
44
+                  btnSearch = icon("search"), 
45
+                  btnReset = icon("remove"), 
46
+                  width = "100%"),
47
+      hr(),
48
+      radioButtons("selcol", "Colour by",
49
+                   choices = c("None",
50
+                               "DHB",
51
+                               "Snargleflagen")),
52
+      hr(),
53
+      checkboxInput("dhboverlay", "Show DHB boundaries"),
54
+      hr(),
55
+      actionLink("closedrop", label = "close", icon = icon("close"),
56
+                 style="float:right"),
57
+      circle=FALSE, inputId = "ddown", right = TRUE,
58
+      label = "Options", inline = FALSE, icon = icon("gear"), status = "danger")),
59
+    leafletOutput(outputId = "medmap")
42 60
 )
43 61
 
62
+
44 63
 server <- function(input, output) {
45 64
     output$medmap <- renderLeaflet({
46 65
         leaflet(Geo2017) %>%
@@ -49,6 +68,11 @@ server <- function(input, output) {
49 68
                        lat = Geo2017$lat,
50 69
                        popup = Geo2017$name)
51 70
     })
71
+
72
+    observeEvent(input$closedrop, {
73
+      toggleDropdownButton("ddown")
74
+    })
75
+
52 76
 }
53 77
 
54 78
 # Run the application