Fix Theme Dropdown in deployed theme space (#6528)

* theme dropdown

* lint

* add changeset

* fix app

* Lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Freddy Boulton 2023-11-21 19:55:47 -05:00 committed by GitHub
parent 830b6c0e6e
commit f53b01cbfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 16 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
fix:Fix Theme Dropdown in deployed theme space

View File

@ -6,7 +6,7 @@ from gradio.themes.utils.theme_dropdown import create_theme_dropdown
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(
"""
@ -17,9 +17,9 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
"""
)
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(
@ -65,12 +65,11 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
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)
@ -85,11 +84,9 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
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")
@ -115,8 +112,9 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
"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):

View File

@ -37,7 +37,8 @@ def create_theme_dropdown():
value=latest_to_oldest[0],
render=False,
label="Select Version",
).style(container=False)
container=False,
)
return (
component,