snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
66
apps/v4/examples/radix/tooltip-rtl.tsx
Normal file
66
apps/v4/examples/radix/tooltip-rtl.tsx
Normal file
@@ -0,0 +1,66 @@
|
||||
"use client"
|
||||
|
||||
import {
|
||||
useTranslation,
|
||||
type Translations,
|
||||
} from "@/components/language-selector"
|
||||
import { Button } from "@/styles/radix-nova/ui-rtl/button"
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "@/styles/radix-nova/ui-rtl/tooltip"
|
||||
|
||||
const translations: Translations = {
|
||||
en: {
|
||||
dir: "ltr",
|
||||
values: {
|
||||
content: "Add to library",
|
||||
left: "Left",
|
||||
top: "Top",
|
||||
bottom: "Bottom",
|
||||
right: "Right",
|
||||
},
|
||||
},
|
||||
ar: {
|
||||
dir: "rtl",
|
||||
values: {
|
||||
content: "إضافة إلى المكتبة",
|
||||
left: "يسار",
|
||||
top: "أعلى",
|
||||
bottom: "أسفل",
|
||||
right: "يمين",
|
||||
},
|
||||
},
|
||||
he: {
|
||||
dir: "rtl",
|
||||
values: {
|
||||
content: "הוסף לספרייה",
|
||||
left: "שמאל",
|
||||
top: "למעלה",
|
||||
bottom: "למטה",
|
||||
right: "ימין",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
const sides = ["left", "top", "bottom", "right"] as const
|
||||
|
||||
export function TooltipRtl() {
|
||||
const { t } = useTranslation(translations, "ar")
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{sides.map((side) => (
|
||||
<Tooltip key={side}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button variant="outline" className="w-fit capitalize">
|
||||
{t[side]}
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side={side}>{t.content}</TooltipContent>
|
||||
</Tooltip>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user