-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add compare-image-label component & fix light theme
- Loading branch information
1 parent
1bad011
commit 0419c35
Showing
4 changed files
with
81 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { cn, formatTime } from "@/lib/utils"; | ||
import { LoaderIcon } from "lucide-react"; | ||
|
||
interface CompareImageLabelProps { | ||
modelData: any; | ||
name: string; | ||
position?: "left" | "right"; | ||
} | ||
|
||
const CompareImageLabel = ({ | ||
modelData, | ||
name, | ||
position = "left", | ||
}: CompareImageLabelProps) => ( | ||
<div | ||
className={cn( | ||
"absolute flex items-center space-x-2 top-[50%] text-black dark:text-white bg-white/40 dark:bg-black/50 text-xs py-1 rounded-full px-2", | ||
position === "right" ? "right-4" : "left-4" | ||
)} | ||
> | ||
<span>{name}</span> | ||
{modelData ? ( | ||
<span className={!modelData ? "text-neutral-500" : "text-green-400"}> | ||
{modelData ? formatTime(modelData.inferenceTime * 1000) : `n/a`} | ||
</span> | ||
) : ( | ||
<LoaderIcon className="animate-spin w-4 h-4 text-green-400" /> | ||
)} | ||
</div> | ||
); | ||
|
||
export default CompareImageLabel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters