Skip to content

Commit 5b28185

Browse files
committed
feat: live-data-animation
1 parent 1ae3203 commit 5b28185

File tree

5 files changed

+88
-2
lines changed

5 files changed

+88
-2
lines changed

infrastructure/control-panel/src/app.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,6 @@
6666
--color-danger-300: #ff968e;
6767
--color-danger-400: #ff7b77;
6868
--color-danger-500: #ff5255;
69+
70+
--color-green: #0FB340;
6971
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { ComponentProps } from 'svelte';
2+
import { LiveDataFlow } from '..';
3+
4+
export default {
5+
title: 'UI/LiveDataFlow',
6+
component: LiveDataFlow,
7+
tags: ['autodocs'],
8+
render: (args: { Component: LiveDataFlow; props: ComponentProps<typeof LiveDataFlow> }) => ({
9+
Component: LiveDataFlow,
10+
props: args
11+
})
12+
};
13+
14+
export const Default = {
15+
args: {}
16+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<script lang="ts">
2+
import { Database01FreeIcons } from "@hugeicons/core-free-icons";
3+
import { HugeiconsIcon } from "@hugeicons/svelte";
4+
5+
let isPaused = $state(false);
6+
7+
const dummyEvents = [
8+
{ id: 1, from: "alice", to: "pictique" },
9+
{ id: 2, from: "pictique", to: "bob" }
10+
];
11+
</script>
12+
13+
<style>
14+
.dot{
15+
offset-path: rect(0px 92% 175px 0px round 10%);
16+
offset-distance: 0%;
17+
offset-rotate: auto;
18+
animation: move 10s linear infinite;
19+
}
20+
21+
@keyframes move {
22+
0% {
23+
offset-distance: 0%;
24+
}
25+
25% {
26+
offset-distance: 25%;
27+
}
28+
50% {
29+
offset-distance: 50%;
30+
}
31+
75% {
32+
offset-distance: 75%;
33+
}
34+
100% {
35+
offset-distance: 100%;
36+
}
37+
}
38+
</style>
39+
40+
<article class="w-full h-[80vh] px-16 flex items-center bg-gray rounded-md">
41+
<div class="relative w-full flex justify-between items-center z-10">
42+
<!-- svelte-ignore element_invalid_self_closing_tag -->
43+
<div class="w-[92%] h-[175px] absolute top-[55%] start-[50%] translate-x-[-50%] bg-transparent border border-t-transparent border-s-green border-b-green border-e-green rounded-md">
44+
<div class="dot absolute h-2.5 w-2.5 top-0 start-[-1px] bg-green rounded-full"/>
45+
</div>
46+
47+
<div class="flex flex-col items-center justify-center rounded-md gap-2 bg-white p-3 border border-black/10">
48+
<HugeiconsIcon icon={Database01FreeIcons}/>
49+
<div class="font-semibold text-sm">Alice</div>
50+
<div class="text-xs text-gray-500">alice.vault.dev</div>
51+
</div>
52+
53+
<div class="bg-white p-3 rounded-md shadow absolute top-[200px] start-[50%] translate-x-[-50%] text-center">
54+
<img src="/" alt="Icon">
55+
<div class="text-xs text-gray-700">pictique</div>
56+
</div>
57+
58+
<div class="flex flex-col items-center justify-center rounded-md gap-2 bg-white p-3 border border-green">
59+
<HugeiconsIcon icon={Database01FreeIcons}/>
60+
<div class="font-semibold text-sm">BOB</div>
61+
<div class="text-xs text-gray-500">BOB.vault.dev</div>
62+
</div>
63+
</div>
64+
</article>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as LiveDataFlow } from "./LiveDataFlow/LiveDataFlow.svelte";

infrastructure/control-panel/src/routes/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import { Table } from "$lib/ui";
3+
import { LiveDataFlow } from "../fragments";
34
45
const handlePreviousPage = async () => {
56
alert('Previous btn clicked. Make a call to your server to fetch data.');
@@ -72,7 +73,7 @@ const mappedData = tableData.map((row) => {
7273
</script>
7374

7475

75-
<section>
76+
<!-- <section>
7677
<Table
7778
class="mb-7"
7879
tableData= {mappedData}
@@ -87,4 +88,6 @@ const mappedData = tableData.map((row) => {
8788
{handlePreviousPage}
8889
{handleNextPage}
8990
/>
90-
</section>
91+
</section> -->
92+
93+
<LiveDataFlow/>

0 commit comments

Comments
 (0)