+
)}
-
diff --git a/src/components/ui/BoxRadio.tsx b/src/components/ui/BoxRadio.tsx
new file mode 100644
index 00000000..3254c413
--- /dev/null
+++ b/src/components/ui/BoxRadio.tsx
@@ -0,0 +1,92 @@
+import { cn } from "~/lib/utils"
+import React, {
+ ChangeEvent,
+ FocusEvent,
+ Dispatch,
+ SetStateAction,
+ useMemo,
+ useState,
+} from "react"
+import { UniLink } from "./UniLink"
+import { useTranslation } from "next-i18next"
+import { nanoid } from "nanoid"
+import { Input } from "~/components/ui/Input"
+
+export type RadioItem = {
+ text: string
+ value?: string
+ default?: boolean
+}
+
+export const BoxRadio: React.FC<{
+ value: string
+ setValue: Dispatch
>
+ items: RadioItem[]
+}> = ({ value, setValue, items }) => {
+ const { t } = useTranslation(["dashboard"])
+ const randomId = useMemo(() => nanoid(), [])
+ const [isCustom, setIsCustom] = useState(false)
+
+ const toCustom = (
+ e: ChangeEvent | FocusEvent,
+ ) => {
+ setIsCustom(true)
+ setValue(e.target.value)
+ }
+
+ const toDefined = (e: ChangeEvent) => {
+ setIsCustom(false)
+ setValue(e.target.value)
+ }
+
+ return (
+
+ )
+}
diff --git a/src/components/ui/Tabs.tsx b/src/components/ui/Tabs.tsx
index e65b9af1..6dfc7c24 100644
--- a/src/components/ui/Tabs.tsx
+++ b/src/components/ui/Tabs.tsx
@@ -2,6 +2,7 @@ import { cn } from "~/lib/utils"
import React from "react"
import { UniLink } from "./UniLink"
import { useTranslation } from "next-i18next"
+import { Tooltip } from "~/components/ui/Tooltip"
export type TabItem = {
text: string
@@ -9,6 +10,7 @@ export type TabItem = {
hidden?: boolean
onClick?: () => void
active?: boolean
+ tooltip?: string
}
export const Tabs: React.FC<{ items: TabItem[] }> = ({ items }) => {
@@ -25,13 +27,19 @@ export const Tabs: React.FC<{ items: TabItem[] }> = ({ items }) => {
onClick={item.onClick}
key={item.text}
className={cn(
- `border-b-2 inline-flex items-center h-10 whitespace-nowrap`,
+ `border-b-2 inline-flex items-center h-10 whitespace-nowrap cursor-pointer`,
item.active
? `border-accent text-black font-medium`
: `text-gray-500 border-transparent hover:border-gray-300`,
)}
>
- {t(item.text)}
+ {item.tooltip ? (
+
+ <>{t(item.text)}>
+
+ ) : (
+ <>{t(item.text)}>
+ )}
)
})}
diff --git a/src/components/ui/Tooltip.tsx b/src/components/ui/Tooltip.tsx
index 0a0c2c93..b44986fd 100644
--- a/src/components/ui/Tooltip.tsx
+++ b/src/components/ui/Tooltip.tsx
@@ -20,6 +20,7 @@ interface Props {
placement?: Placement
children: JSX.Element
className?: string
+ inline?: boolean
}
export const Tooltip = ({
@@ -27,6 +28,7 @@ export const Tooltip = ({
label,
placement = "top",
className,
+ inline,
}: Props) => {
const [open, setOpen] = useState(false)
@@ -54,7 +56,7 @@ export const Tooltip = ({
{children}