-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocument-mode-toggle.tsx
More file actions
64 lines (60 loc) · 1.81 KB
/
document-mode-toggle.tsx
File metadata and controls
64 lines (60 loc) · 1.81 KB
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
56
57
58
59
60
61
62
63
64
import { FC } from "react";
import { Switch } from "@/components/ui/switch";
import { Label } from "@/components/ui/label";
import { cn } from "@/lib/utils";
interface DocumentModeToggleProps {
mode: "preview" | "live";
onChange: (mode: "preview" | "live") => void;
disabled?: boolean;
className?: string;
}
const DocumentModeToggle: FC<DocumentModeToggleProps> = ({
mode,
onChange,
disabled = false,
className
}) => {
const handleToggle = (checked: boolean) => {
onChange(checked ? "live" : "preview");
};
return (
<div className={cn("p-3 bg-slate-100 rounded-md", className)}>
<div className="flex items-center justify-between">
<span className="text-sm font-medium text-slate-700">Mode:</span>
<div className="flex items-center space-x-2">
<span className={cn(
"text-sm",
mode === "preview" ? "text-slate-900 font-medium" : "text-slate-500"
)}>
PREVIEW
</span>
<Switch
checked={mode === "live"}
onCheckedChange={handleToggle}
disabled={disabled}
id="mode-toggle"
/>
<Label
htmlFor="mode-toggle"
className={cn(
"text-sm cursor-pointer",
mode === "live" ? "text-slate-900 font-medium" : "text-slate-500"
)}
>
LIVE
</Label>
</div>
</div>
{mode === "preview" ? (
<p className="mt-1 text-xs text-slate-500">
PREVIEW mode: Test your document flows without using your quota.
</p>
) : (
<p className="mt-1 text-xs text-slate-500">
LIVE mode: Send documents for real signatures. Uses your monthly quota.
</p>
)}
</div>
);
};
export default DocumentModeToggle;