Skip to content

Commit

Permalink
Remove the styles from the Image/Video primitive components and Fix t…
Browse files Browse the repository at this point in the history
…he container styles (#6726)

* Remove the styles from the Image/Video primitive components and Fix the container styles

* add changeset

* Fix image example size styles

* Remove border from image/Example with type=gallery

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
whitphx and gradio-pr-bot committed Dec 11, 2023
1 parent a1b966e commit 21cfb0a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .changeset/legal-geese-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@gradio/image": minor
"@gradio/video": minor
"gradio": minor
---

feat:Remove the styles from the Image/Video primitive components and Fix the container styles
7 changes: 6 additions & 1 deletion js/image/Example.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
</div>

<style>
.container :global(img) {
width: 100%;
height: 100%;
}
.container.selected {
border-color: var(--border-color-accent);
}
Expand All @@ -25,13 +30,13 @@
margin: 0 auto;
border: 2px solid var(--border-color-primary);
border-radius: var(--radius-lg);
overflow: hidden;
width: var(--size-20);
height: var(--size-20);
object-fit: cover;
}
.container.gallery {
border: 2px solid var(--border-color-primary);
height: var(--size-20);
max-height: var(--size-20);
object-fit: cover;
Expand Down
8 changes: 0 additions & 8 deletions js/image/shared/Image.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,3 @@
{:catch error}
<p style="color: red;">{error.message}</p>
{/await}

<style>
img {
width: 100%;
height: 100%;
border-radius: var(--radius-lg);
}
</style>
10 changes: 8 additions & 2 deletions js/video/Example.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,23 @@
<style>
.container {
flex: none;
border: 2px solid var(--border-color-primary);
border-radius: var(--radius-lg);
max-width: none;
}
.container :global(video) {
width: var(--size-full);
height: var(--size-full);
object-fit: cover;
}
.container:hover,
.container.selected {
border-color: var(--border-color-accent);
}
.container.table {
margin: 0 auto;
border: 2px solid var(--border-color-primary);
border-radius: var(--radius-lg);
overflow: hidden;
width: var(--size-20);
height: var(--size-20);
object-fit: cover;
Expand Down
4 changes: 4 additions & 0 deletions js/video/shared/Player.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,8 @@
width: var(--size-full);
border-radius: var(--radius-xl);
}
.wrap :global(video) {
height: var(--size-full);
width: var(--size-full);
}
</style>
9 changes: 0 additions & 9 deletions js/video/shared/Video.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,4 @@
background: #fff;
}
}
video {
position: inherit;
background-color: black;
width: var(--size-full);
height: var(--size-full);
object-fit: contain;
border-radius: var(--radius-xl);
}
</style>

0 comments on commit 21cfb0a

Please sign in to comment.