File size: 897 Bytes
be5030f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<script lang="ts">
  import { Streamlit, setStreamlitLifecycle } from "./streamlit";
  setStreamlitLifecycle();

  export let imageUrls: Array<string>;
  export let height: number;

  let selectedImageUrl: string;

  function image_onclick(event: any) {
    selectedImageUrl = event.srcElement.currentSrc;
    Streamlit.setComponentValue(selectedImageUrl);
  }
</script>


<div class="scroller">
  {#each imageUrls as imageUrl}
      <img src={imageUrl} id={imageUrl} alt="" style="height: {height}px;" on:click={image_onclick}>
  {/each}
</div>


<style>
  .scroller {
    min-height: 100px;
    overflow-x: scroll;
    overflow-y: hidden;
    white-space: nowrap;
  }
	img { 
    display: inline-block;
    padding: 1%;
    border-radius: 20px;
    opacity: 0.9; 
    transition: all .2s; 
  }

	img:hover { 
    opacity: 1; 
    transform: scale(1.05); 
    cursor: pointer;
  }
</style>