Home / File/ tooltip-rtl.tsx — ui Source File

tooltip-rtl.tsx — ui Source File

Architecture documentation for tooltip-rtl.tsx, a tsx file in the ui codebase. 3 imports, 0 dependents.

File tsx DocumentationAtlas Changelog 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  f4bd81ad_77cd_a46c_a9c0_4f74131ec657["tooltip-rtl.tsx"]
  43bb9fc1_6eab_13df_a99b_981eb13b9ec1["button"]
  f4bd81ad_77cd_a46c_a9c0_4f74131ec657 --> 43bb9fc1_6eab_13df_a99b_981eb13b9ec1
  6544c2c5_b5c4_9182_1e6a_d512018c1eb1["tooltip"]
  f4bd81ad_77cd_a46c_a9c0_4f74131ec657 --> 6544c2c5_b5c4_9182_1e6a_d512018c1eb1
  2c1404ab_bf28_6225_f9a0_b9e29400c66c["language-selector"]
  f4bd81ad_77cd_a46c_a9c0_4f74131ec657 --> 2c1404ab_bf28_6225_f9a0_b9e29400c66c
  style f4bd81ad_77cd_a46c_a9c0_4f74131ec657 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import { Button } from "@/examples/base/ui-rtl/button"
import {
  Tooltip,
  TooltipContent,
  TooltipTrigger,
} from "@/examples/base/ui-rtl/tooltip"

import {
  useTranslation,
  type Translations,
} from "@/components/language-selector"

const translations: Translations = {
  en: {
    dir: "ltr",
    values: {
      content: "Add to library",
      "inline-start": "Inline Start",
      left: "Left",
      top: "Top",
      bottom: "Bottom",
      right: "Right",
      "inline-end": "Inline End",
    },
  },
  ar: {
    dir: "rtl",
    values: {
      content: "إضافة إلى المكتبة",
      "inline-start": "بداية السطر",
      left: "يسار",
      top: "أعلى",
      bottom: "أسفل",
      right: "يمين",
      "inline-end": "نهاية السطر",
    },
  },
  he: {
    dir: "rtl",
    values: {
      content: "הוסף לספרייה",
      "inline-start": "תחילת השורה",
      left: "שמאל",
      top: "למעלה",
      bottom: "למטה",
      right: "ימין",
      "inline-end": "סוף השורה",
    },
  },
}

const physicalSides = ["left", "top", "bottom", "right"] as const
const logicalSides = ["inline-start", "inline-end"] as const

export function TooltipRtl() {
  const { dir, t } = useTranslation(translations, "ar")

  return (
    <div className="grid gap-4">
      <div className="flex flex-wrap justify-center gap-2">
        {physicalSides.map((side) => (
          <Tooltip key={side}>
            <TooltipTrigger render={<Button variant="outline" />}>
              {t[side]}
            </TooltipTrigger>
            <TooltipContent side={side} dir={dir}>
              {t.content}
            </TooltipContent>
          </Tooltip>
        ))}
      </div>
      <div className="flex flex-wrap justify-center gap-2">
        {logicalSides.map((side) => (
          <Tooltip key={side}>
            <TooltipTrigger render={<Button variant="outline" />}>
              {t[side]}
            </TooltipTrigger>
            <TooltipContent side={side} dir={dir}>
              {t.content}
            </TooltipContent>
          </Tooltip>
        ))}
      </div>
    </div>
  )
}

Subdomains

Functions

Dependencies

  • button
  • language-selector
  • tooltip

Frequently Asked Questions

What does tooltip-rtl.tsx do?
tooltip-rtl.tsx is a source file in the ui codebase, written in tsx. It belongs to the DocumentationAtlas domain, Changelog subdomain.
What functions are defined in tooltip-rtl.tsx?
tooltip-rtl.tsx defines 1 function(s): TooltipRtl.
What does tooltip-rtl.tsx depend on?
tooltip-rtl.tsx imports 3 module(s): button, language-selector, tooltip.
Where is tooltip-rtl.tsx in the architecture?
tooltip-rtl.tsx is located at apps/v4/examples/base/tooltip-rtl.tsx (domain: DocumentationAtlas, subdomain: Changelog, directory: apps/v4/examples/base).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free