show basic idea
This commit is contained in:
7
src/lib/components/ui/progress/index.ts
Normal file
7
src/lib/components/ui/progress/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import Root from "./progress.svelte";
|
||||
|
||||
export {
|
||||
Root,
|
||||
//
|
||||
Root as Progress,
|
||||
};
|
||||
21
src/lib/components/ui/progress/progress.svelte
Normal file
21
src/lib/components/ui/progress/progress.svelte
Normal file
@@ -0,0 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { Progress as ProgressPrimitive } from "bits-ui";
|
||||
import { cn } from "$lib/utils.js";
|
||||
|
||||
type $$Props = ProgressPrimitive.Props;
|
||||
|
||||
let className: $$Props["class"] = undefined;
|
||||
export let max: $$Props["max"] = 100;
|
||||
export let value: $$Props["value"] = undefined;
|
||||
export { className as class };
|
||||
</script>
|
||||
|
||||
<ProgressPrimitive.Root
|
||||
class={cn("bg-secondary relative h-4 w-full overflow-hidden rounded-full", className)}
|
||||
{...$$restProps}
|
||||
>
|
||||
<div
|
||||
class="bg-primary h-full w-full flex-1 transition-all"
|
||||
style={`transform: translateX(-${100 - (100 * (value ?? 0)) / (max ?? 1)}%)`}
|
||||
></div>
|
||||
</ProgressPrimitive.Root>
|
||||
Reference in New Issue
Block a user