Skip to content

Commit

Permalink
Fix Theme Dropdown in deployed theme space (#6528)
Browse files Browse the repository at this point in the history
* theme dropdown

* lint

* add changeset

* fix app

* Lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
freddyaboulton and gradio-pr-bot committed Nov 22, 2023
1 parent 830b6c0 commit f53b01c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/easy-turtles-tie.md
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:Fix Theme Dropdown in deployed theme space
28 changes: 13 additions & 15 deletions gradio/themes/app.py
Expand Up @@ -6,7 +6,7 @@
dropdown, js = create_theme_dropdown()

with gr.Blocks(theme=gr.themes.Default()) as demo:
with gr.Row().style(equal_height=True):
with gr.Row(equal_height=True):
with gr.Column(scale=10):
gr.Markdown(
"""
Expand All @@ -17,9 +17,9 @@
"""
)
with gr.Column(scale=3):
with gr.Box():
with gr.Group():
dropdown.render()
toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True)
toggle_dark = gr.Button(value="Toggle Dark")

dropdown.change(None, dropdown, None, js=js)
toggle_dark.click(
Expand Down Expand Up @@ -65,12 +65,11 @@
img = gr.Image(
"https://gradio-static-files.s3.us-west-2.amazonaws.com/header-image.jpg",
label="Image",
).style(height=320)
height=320,
)
with gr.Row():
go_btn = gr.Button("Go", label="Primary Button", variant="primary")
clear_btn = gr.Button(
"Clear", label="Secondary Button", variant="secondary"
)
go_btn = gr.Button("Go", variant="primary")
clear_btn = gr.Button("Clear", variant="secondary")

def go(*args):
time.sleep(3)
Expand All @@ -85,11 +84,9 @@ def clear():
clear_btn.click(clear, None, img)

with gr.Row():
btn1 = gr.Button("Button 1").style(size="sm")
btn2 = gr.UploadButton().style(size="sm")
stop_btn = gr.Button("Stop", label="Stop Button", variant="stop").style(
size="sm"
)
btn1 = gr.Button("Button 1", size="sm")
btn2 = gr.UploadButton(size="sm")
stop_btn = gr.Button("Stop", size="sm", variant="stop")

with gr.Row():
gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
Expand All @@ -115,8 +112,9 @@ def clear():
"https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
"tower",
),
]
).style(height="200px", grid=2)
],
height=200,
)

with gr.Row():
with gr.Column(scale=2):
Expand Down
3 changes: 2 additions & 1 deletion gradio/themes/utils/theme_dropdown.py
Expand Up @@ -37,7 +37,8 @@ def make_else_if(theme_asset):
value=latest_to_oldest[0],
render=False,
label="Select Version",
).style(container=False)
container=False,
)

return (
component,
Expand Down

0 comments on commit f53b01c

Please sign in to comment.