Skip to content

Commit 4878f40

Browse files
committed
Add indeterminate progress styling
1 parent a6e93c3 commit 4878f40

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

frontend/components/matching/search-progress.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function SearchProgress({ waitTime }: SearchProgressProps) {
2424
</CardHeader>
2525
<CardContent>
2626
<div className="space-y-4">
27-
<Progress value={(waitTime % 60) * (100 / 60)} className="w-full" />
27+
<Progress className="w-full" indeterminate />
2828
<div className="flex items-center justify-between">
2929
<div className="flex items-center space-x-2">
3030
<Clock className="h-4 w-4" />
Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
1-
"use client"
1+
"use client";
22

3-
import * as React from "react"
4-
import * as ProgressPrimitive from "@radix-ui/react-progress"
3+
import * as React from "react";
4+
import * as ProgressPrimitive from "@radix-ui/react-progress";
55

6-
import { cn } from "@/lib/utils"
6+
import { cn } from "@/lib/utils";
7+
8+
interface ProgressProps
9+
extends React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root> {
10+
indeterminate?: boolean;
11+
}
712

813
const Progress = React.forwardRef<
914
React.ElementRef<typeof ProgressPrimitive.Root>,
10-
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
11-
>(({ className, value, ...props }, ref) => (
15+
ProgressProps
16+
>(({ className, value, indeterminate = false, ...props }, ref) => (
1217
<ProgressPrimitive.Root
1318
ref={ref}
1419
className={cn(
15-
"relative h-2 w-full overflow-hidden rounded-full bg-primary/20",
20+
"relative h-4 w-full overflow-hidden rounded-full bg-secondary",
1621
className
1722
)}
1823
{...props}
1924
>
2025
<ProgressPrimitive.Indicator
21-
className="h-full w-full flex-1 bg-primary transition-all"
26+
className={cn(
27+
"h-full w-full flex-1 bg-primary transition-all",
28+
indeterminate && "animate-progress origin-left"
29+
)}
2230
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
2331
/>
2432
</ProgressPrimitive.Root>
25-
))
26-
Progress.displayName = ProgressPrimitive.Root.displayName
33+
));
34+
Progress.displayName = ProgressPrimitive.Root.displayName;
2735

28-
export { Progress }
36+
export { Progress };

frontend/tailwind.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ const config: Config = {
5656
md: "calc(var(--radius) - 2px)",
5757
sm: "calc(var(--radius) - 4px)",
5858
},
59+
keyframes: {
60+
progress: {
61+
"0%": { transform: "translateX(0) scaleX(0)" },
62+
"40%": { transform: "translateX(0) scaleX(0.4)" },
63+
"100%": { transform: "translateX(100%) scaleX(0.5)" },
64+
},
65+
},
66+
animation: {
67+
progress: "progress 1s infinite linear",
68+
},
5969
},
6070
},
6171
plugins: [require("tailwindcss-animate")],

0 commit comments

Comments
 (0)