aboutsummaryrefslogtreecommitdiff
path: root/src/components/Basic/Bar.svelte
blob: 1b4584d2d9e75c41e1848854d7b37dab398e6f6f (plain) (blame)
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
52
53
54
55
<script lang="ts">
    export let percentage;
    export let value;
</script>

<style>
    :root {
      --progress: 100%;
    }
    
    .wrapper {
        position: relative;
        /* background-color: #c6c6c6; */
        border-radius:15px;
        width: 100%;
        height: 100%;
    }
    
    .bar-wrapper {
        overflow: hidden;
        position: relative;
        border-radius: 15px;
        height: 100%;
        width: 100%;
        left: calc(100% - var(--progress));
    }
    
    .bar {
        position: absolute;
        height: 100%;
        width: 100%;
        right: calc(100% - var(--progress));
        overflow: hidden;
        background: linear-gradient(90deg, 
                                    rgba(255, 42,228,1) 0%,
                                    rgba(164,255,177,1) 60%, 
                                    rgba(214,255,241,1) 85%,
                                    rgba(247,250,252,1) 100%); 
        border-radius: 15px;
    }

    .value {
        position: absolute;
        right: 0.1rem;
        top: 0;
        font-size: 1.5rem;
    }
</style>

<div class="wrapper" style="--progress: {percentage*100}%">
    <div class="bar-wrapper">
        <div class="bar"></div>
    </div>
    <span class="value">{value}</span>
</div>