Tasmay-Tib commited on
Commit
c07cc3d
·
1 Parent(s): 8778e26

fixed buttons

Browse files
Files changed (1) hide show
  1. app.py +50 -20
app.py CHANGED
@@ -1834,17 +1834,48 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
1834
  .gradio-container .block-label { font-size: 1rem !important; }
1835
 
1836
  /* Button sizing and layout: single-row compact triple buttons */
1837
- #buttons_row { display: flex !important; gap: 6px !important; flex-wrap: nowrap !important; align-items: center !important; }
1838
- #btn_send, #btn_clear, #btn_sources, #btn_search { display: inline-flex !important; width: 33% !important; flex: 0 0 auto !important; }
1839
- #btn_send > button, #btn_clear > button, #btn_sources > button, #btn_search > button,
1840
- #btn_send button, #btn_clear button, #btn_sources button, #btn_search button {
1841
- font-size: 0.95rem !important;
1842
- padding: 6px 10px !important;
1843
- width: auto !important;
1844
- min-width: 40px !important;
1845
- max-width: 80px !important;
1846
- white-space: nowrap !important;
1847
- line-height: 1.2 !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1848
  }
1849
 
1850
  /* Expand center chat area and compact Sources sidebar bubbles */
@@ -1908,15 +1939,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
1908
  with gr.Row():
1909
  with gr.Column(elem_id="right_col"):
1910
  chatbot = gr.Chatbot(label="Chat", type="messages", height=520, elem_id="main_chat", autoscroll=False)
1911
- with gr.Row():
1912
- user_input = gr.Textbox(label="User Input", placeholder="Ask a web question…", lines=1, scale=4)
1913
- with gr.Column(scale=2, min_width=50):
1914
- with gr.Row(elem_id="buttons_row"):
1915
- submit_button = gr.Button("Send", variant="primary", scale=1, elem_id="btn_send")
1916
- clear_button = gr.Button("Clear", scale=1, elem_id="btn_clear")
1917
- with gr.Row(elem_id="buttons_row"):
1918
- search_button = gr.Button("DeepResearch ON", variant="huggingface", scale=1, elem_id="btn_search")
1919
- sources_button = gr.Button("Sources", scale=1, elem_id="btn_sources")
1920
 
1921
  gr.Markdown("### Example questions")
1922
  with gr.Row():
 
1834
  .gradio-container .block-label { font-size: 1rem !important; }
1835
 
1836
  /* Button sizing and layout: single-row compact triple buttons */
1837
+ /* --- Responsive composer that matches chat width --- */
1838
+ #composer_row {
1839
+ display: flex;
1840
+ flex-wrap: wrap; /* allow wrapping on small screens */
1841
+ gap: 8px;
1842
+ align-items: stretch;
1843
+ }
1844
+
1845
+ /* Let the input and the controls share the row and wrap when needed */
1846
+ #composer_input { flex: 1 1 480px; min-width: 0; }
1847
+ #controls_col { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
1848
+
1849
+ /* 2×2 grid; only this gap applies */
1850
+ #buttons_grid {
1851
+ display: grid !important;
1852
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1853
+ gap: 6px; /* ← your only spacing */
1854
+ margin: 0 !important; /* no extra vertical space */
1855
+ padding: 0 !important;
1856
+ }
1857
+ #buttons_grid button { width: 100%; }
1858
+
1859
+ /* Two equal-width buttons per row; allow them to shrink and wrap text if needed */
1860
+ #buttons_row_top,
1861
+ #buttons_row_bottom {
1862
+ display: flex;
1863
+ gap: 6px;
1864
+ }
1865
+
1866
+ #buttons_row_top > *,
1867
+ #buttons_row_bottom > * {
1868
+ flex: 1 1 0; /* equal widths without hard max-widths */
1869
+ min-width: 0; /* allow shrinking instead of overflowing */
1870
+ }
1871
+
1872
+ /* Make the actual <button> fill its component's width */
1873
+ #controls_col button { width: 100%; }
1874
+
1875
+ /* On narrow screens, stack input above the controls so nothing overflows */
1876
+ @media (max-width: 820px) {
1877
+ #composer_input,
1878
+ #controls_col { flex-basis: 100% !important; }
1879
  }
1880
 
1881
  /* Expand center chat area and compact Sources sidebar bubbles */
 
1939
  with gr.Row():
1940
  with gr.Column(elem_id="right_col"):
1941
  chatbot = gr.Chatbot(label="Chat", type="messages", height=520, elem_id="main_chat", autoscroll=False)
1942
+ with gr.Row(elem_id="composer_row", equal_height=True):
1943
+ user_input = gr.Textbox(label="User Input", placeholder="Ask a web question…", lines=1, scale=5, min_width=280, elem_id="composer_input")
1944
+ with gr.Column(scale=2, min_width=220):
1945
+ with gr.Row(elem_id="buttons_grid"): # one container
1946
+ submit_button = gr.Button("Send", variant="primary")
1947
+ clear_button = gr.Button("Clear")
1948
+ search_button = gr.Button("DeepResearch ON", variant="huggingface")
1949
+ sources_button = gr.Button("Sources")
 
1950
 
1951
  gr.Markdown("### Example questions")
1952
  with gr.Row():