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

progress-rtl.tsx — ui Source File

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

File tsx DocumentationAtlas SearchAPI 4 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  e24baca3_f7bb_5664_f599_8dbf42981627["progress-rtl.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  e24baca3_f7bb_5664_f599_8dbf42981627 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  68874b2d_841d_f625_bf4f_104dc94b730e["field"]
  e24baca3_f7bb_5664_f599_8dbf42981627 --> 68874b2d_841d_f625_bf4f_104dc94b730e
  3e6c445f_0b8f_0eb7_3228_6018c1094d28["progress"]
  e24baca3_f7bb_5664_f599_8dbf42981627 --> 3e6c445f_0b8f_0eb7_3228_6018c1094d28
  2c1404ab_bf28_6225_f9a0_b9e29400c66c["language-selector"]
  e24baca3_f7bb_5664_f599_8dbf42981627 --> 2c1404ab_bf28_6225_f9a0_b9e29400c66c
  style e24baca3_f7bb_5664_f599_8dbf42981627 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { Field, FieldLabel } from "@/examples/radix/ui-rtl/field"
import { Progress } from "@/examples/radix/ui-rtl/progress"

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

const translations: Translations = {
  en: {
    dir: "ltr",
    values: {
      label: "Upload progress",
    },
  },
  ar: {
    dir: "rtl",
    values: {
      label: "تقدم الرفع",
    },
  },
  he: {
    dir: "rtl",
    values: {
      label: "התקדמות העלאה",
    },
  },
}

function toArabicNumerals(num: number): string {
  const arabicNumerals = ["٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"]
  return num
    .toString()
    .split("")
    .map((digit) => arabicNumerals[parseInt(digit, 10)])
    .join("")
}

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

  const formatNumber = (num: number): string => {
    if (language === "ar") {
      return toArabicNumerals(num)
    }
    return num.toString()
  }

  return (
    <Field className="w-full max-w-sm" dir={dir}>
      <FieldLabel htmlFor="progress-upload">
        <span>{t.label}</span>
        <span className="ms-auto">{formatNumber(66)}%</span>
      </FieldLabel>
      <Progress value={66} id="progress-upload" className="rtl:rotate-180" />
    </Field>
  )
}

Subdomains

Dependencies

  • field
  • language-selector
  • progress
  • react

Frequently Asked Questions

What does progress-rtl.tsx do?
progress-rtl.tsx is a source file in the ui codebase, written in tsx. It belongs to the DocumentationAtlas domain, SearchAPI subdomain.
What functions are defined in progress-rtl.tsx?
progress-rtl.tsx defines 2 function(s): ProgressRtl, toArabicNumerals.
What does progress-rtl.tsx depend on?
progress-rtl.tsx imports 4 module(s): field, language-selector, progress, react.
Where is progress-rtl.tsx in the architecture?
progress-rtl.tsx is located at apps/v4/examples/radix/progress-rtl.tsx (domain: DocumentationAtlas, subdomain: SearchAPI, directory: apps/v4/examples/radix).

Analyze Your Own Codebase

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

Try Supermodel Free