gordon-posit commited on
Commit
4fbb376
1 Parent(s): 02f4a0c

Update css

Browse files
Files changed (2) hide show
  1. app.py +16 -4
  2. query.py +1 -0
app.py CHANGED
@@ -1,10 +1,12 @@
1
  from pathlib import Path
2
 
3
- from htmltools import HTMLDependency
4
  from shiny import App, reactive, ui
5
 
6
  from query import query_output_server, query_output_ui
7
 
 
 
8
  www_dir = Path(__file__).parent / "www"
9
  app_ui = ui.page_fluid(
10
  HTMLDependency(
@@ -17,9 +19,14 @@ app_ui = ui.page_fluid(
17
  ui.row(
18
  ui.column(
19
  2,
20
- ui.br(),
21
- ui.br(),
22
- ui.input_action_button("add_query", "Add Query"),
 
 
 
 
 
23
  ),
24
  ui.column(
25
  10,
@@ -45,5 +52,10 @@ def server(input, output, session):
45
  )
46
  query_output_server(id)
47
 
 
 
 
 
 
48
 
49
  app = App(app_ui, server)
 
1
  from pathlib import Path
2
 
3
+ from htmltools import HTMLDependency, tags
4
  from shiny import App, reactive, ui
5
 
6
  from query import query_output_server, query_output_ui
7
 
8
+ button_style = {"style": "margin: 15px"}
9
+
10
  www_dir = Path(__file__).parent / "www"
11
  app_ui = ui.page_fluid(
12
  HTMLDependency(
 
19
  ui.row(
20
  ui.column(
21
  2,
22
+ ui.row(
23
+ button_style,
24
+ ui.input_action_button("add_query", "Add Query"),
25
+ ),
26
+ ui.row(
27
+ button_style,
28
+ ui.input_action_button("remove_query", "Remove Query"),
29
+ ),
30
  ),
31
  ui.column(
32
  10,
 
52
  )
53
  query_output_server(id)
54
 
55
+ @reactive.Effect
56
+ @reactive.event(input.remove_query)
57
+ def _():
58
+ ui.remove_ui(selector=f"#module_container .row:first-child")
59
+
60
 
61
  app = App(app_ui, server)
query.py CHANGED
@@ -9,6 +9,7 @@ from shiny import module, reactive, render, ui
9
  @module.ui
10
  def query_output_ui():
11
  out = ui.row(
 
12
  ui.column(
13
  4,
14
  ui.input_text("prompt", "Prompt", placeholder="Enter query"),
 
9
  @module.ui
10
  def query_output_ui():
11
  out = ui.row(
12
+ {"style": "border: 1px solid gray; border-radius: 5px; margin:10px"},
13
  ui.column(
14
  4,
15
  ui.input_text("prompt", "Prompt", placeholder="Enter query"),