-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure source selection does not get hidden in overflow (#6279)
* add wrapper around content and source selection * formatting * remove upload 100% height * add changeset * move source selection to atoms * formatting * add changeset * add changeset * add changeset * tweak <Upload /> height to accomodate source selection * add changeset * calc new height with source selection * formatting * tweak --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
- Loading branch information
1 parent
dfdaf10
commit 3cdeabc
Showing
8 changed files
with
124 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@gradio/atoms": patch | ||
"@gradio/audio": patch | ||
"@gradio/upload": patch | ||
"@gradio/video": patch | ||
"gradio": patch | ||
--- | ||
|
||
fix:Ensure source selection does not get hidden in overflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<script lang="ts"> | ||
import { Microphone, Upload, Video } from "@gradio/icons"; | ||
export let sources: string[]; | ||
export let active_source: string; | ||
export let handle_clear: () => void = () => {}; | ||
</script> | ||
|
||
{#if sources.length > 1} | ||
<span class="source-selection"> | ||
{#if sources.includes("upload")} | ||
<button | ||
class="icon" | ||
aria-label="Upload file" | ||
on:click={() => { | ||
handle_clear(); | ||
active_source = "upload"; | ||
}}><Upload /></button | ||
> | ||
{/if} | ||
|
||
{#if sources.includes("microphone")} | ||
<button | ||
class="icon" | ||
aria-label="Record audio" | ||
on:click={() => { | ||
handle_clear(); | ||
active_source = "microphone"; | ||
}}><Microphone /></button | ||
> | ||
{/if} | ||
|
||
{#if sources.includes("webcam")} | ||
<button | ||
class="icon" | ||
aria-label="Record video" | ||
on:click={() => { | ||
handle_clear(); | ||
active_source = "webcam"; | ||
}}><Video /></button | ||
> | ||
{/if} | ||
</span> | ||
{/if} | ||
|
||
<style> | ||
.source-selection { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border-top: 1px solid var(--border-color-primary); | ||
width: 95%; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
margin-left: auto; | ||
margin-right: auto; | ||
align-self: flex-end; | ||
} | ||
.icon { | ||
width: 22px; | ||
height: 22px; | ||
margin: var(--spacing-lg) var(--spacing-xs); | ||
padding: var(--spacing-xs); | ||
color: var(--neutral-400); | ||
border-radius: var(--radius-md); | ||
} | ||
.icon:hover, | ||
.icon:focus { | ||
color: var(--color-accent); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters