forked from jordanlambrecht/tracker-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogScaleToggle.tsx
More file actions
36 lines (32 loc) · 1001 Bytes
/
Copy pathLogScaleToggle.tsx
File metadata and controls
36 lines (32 loc) · 1001 Bytes
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
// src/components/charts/lib/LogScaleToggle.tsx
"use client"
import { ActivityIcon } from "@/components/ui/Icons"
import { Tooltip } from "@/components/ui/Tooltip"
interface LogScaleToggleProps {
effectiveLog: boolean
isAuto: boolean
onToggle: () => void
}
function LogScaleToggle({ effectiveLog, isAuto, onToggle }: LogScaleToggleProps) {
return (
<Tooltip
content={
isAuto
? "Scale: auto-detected. Click to override."
: "Scale: manual override. Click to reset to auto."
}
>
<button
type="button"
onClick={onToggle}
className="timestamp nm-interactive-sm bg-raised px-2.5 py-1 hover:text-secondary cursor-pointer flex items-center gap-2 rounded-nm-sm"
>
<ActivityIcon width="10" height="10" />
{effectiveLog ? "Log" : "Linear"}
{isAuto && <span className="opacity-50">auto</span>}
</button>
</Tooltip>
)
}
export type { LogScaleToggleProps }
export { LogScaleToggle }