Browse Source

Complex UI with dropdown

(no elements implemented)
Petra Lamborn 4 years ago
parent
commit
f54fc33a42
1 changed files with 51 additions and 2 deletions
  1. 51
    2
      MedicalCentres/app.R

+ 51
- 2
MedicalCentres/app.R View File

@@ -1,11 +1,56 @@
1 1
 library(shiny)
2 2
 library(leaflet)
3 3
 library(dplyr)
4
+library(shinyWidgets)
4 5
 
5 6
 Geo2017 <- readRDS("Geo2017.rds")
7
+Geo2017$Snargle <- c(TRUE, rep(FALSE, 5))
6 8
 
7
-ui <- fillPage(
8
-    leafletOutput(outputId = "medmap", height = "100%")
9
+DHBs <- sort(unique(Geo2017$dhb_name))
10
+DHBs <- c(DHBs[DHBs != "Missing"], "Missing")
11
+
12
+
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
+               #ddown {
22
+                 position: absolute;
23
+                 top: 0;
24
+                 right: 0;
25
+                 z-index: 10;
26
+               }"),
27
+    dropdownButton(
28
+      strong("Not Implemented"), hr(),
29
+      searchInput("mapsearch",
30
+                  placeholder = "Search GP practices by name",
31
+                  btnSearch = icon("search"), 
32
+                  btnReset = icon("remove"), 
33
+                  width = "100%"),
34
+      hr(),
35
+      radioButtons("selcol", "Colour by",
36
+                   choices = c("None",
37
+                               "DHB",
38
+                               "Snargleflagen")),
39
+      hr(),
40
+      checkboxInput("dhboverlay", "Show DHBs"),
41
+      hr(),
42
+      #pickerInput("dhbpicker",
43
+      #            label = "Show from DHBs",
44
+      #            choices = DHBs,
45
+      #            multiple = TRUE,
46
+      #            options = pickerOptions(size=3),
47
+      #            selected = DHBs),
48
+      #hr(),
49
+      actionLink("closedrop", label = "close", icon = icon("close"),
50
+                 style="float:right"),
51
+      circle=FALSE, inputId = "ddown", right = TRUE,
52
+      label = "Options", inline = FALSE),
53
+    leafletOutput(outputId = "medmap")
9 54
 )
10 55
 
11 56
 server <- function(input, output) {
@@ -16,6 +61,10 @@ server <- function(input, output) {
16 61
                        lat = Geo2017$lat,
17 62
                        popup = Geo2017$name)
18 63
     })
64
+    
65
+    observeEvent(input$closedrop, {
66
+      toggleDropdownButton("ddown")
67
+    })
19 68
 }
20 69
 
21 70
 # Run the application