Home / File/ field-slider.tsx — ui Source File

field-slider.tsx — ui Source File

Architecture documentation for field-slider.tsx, a tsx file in the ui codebase. 4 imports, 1 dependents.

File tsx Internationalization Dictionary 4 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  3ac85df4_c61a_148b_ad7e_8046ad3db6ee["field-slider.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  3ac85df4_c61a_148b_ad7e_8046ad3db6ee --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  7e9c1e20_5a8a_4152_90a3_40c280dc340e["field"]
  3ac85df4_c61a_148b_ad7e_8046ad3db6ee --> 7e9c1e20_5a8a_4152_90a3_40c280dc340e
  e28d5637_5377_83b7_5524_62bc00e37a39["slider"]
  3ac85df4_c61a_148b_ad7e_8046ad3db6ee --> e28d5637_5377_83b7_5524_62bc00e37a39
  2c1404ab_bf28_6225_f9a0_b9e29400c66c["language-selector"]
  3ac85df4_c61a_148b_ad7e_8046ad3db6ee --> 2c1404ab_bf28_6225_f9a0_b9e29400c66c
  a20493d4_39f4_bced_97b9_027078a02a91["index.tsx"]
  a20493d4_39f4_bced_97b9_027078a02a91 --> 3ac85df4_c61a_148b_ad7e_8046ad3db6ee
  style 3ac85df4_c61a_148b_ad7e_8046ad3db6ee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import { useState } from "react"
import {
  Field,
  FieldDescription,
  FieldTitle,
} from "@/examples/base/ui-rtl/field"
import { Slider } from "@/examples/base/ui-rtl/slider"

import { useLanguageContext } from "@/components/language-selector"

const translations = {
  ar: {
    dir: "rtl" as const,
    locale: "ar-SA",
    title: "نطاق السعر",
    description: "حدد نطاق ميزانيتك",
    ariaLabel: "نطاق السعر",
    currency: "﷼",
  },
  he: {
    dir: "rtl" as const,
    locale: "he-IL",
    title: "טווח מחירים",
    description: "הגדר את טווח התקציב שלך",
    ariaLabel: "טווח מחירים",
    currency: "₪",
  },
}

function formatNumber(value: number, locale: string) {
  return new Intl.NumberFormat(locale).format(value)
}

export function FieldSlider() {
  const context = useLanguageContext()
  const lang = context?.language === "he" ? "he" : "ar"
  const t = translations[lang]
  const [value, setValue] = useState([200, 800])

  return (
    <Field dir={t.dir}>
      <FieldTitle>{t.title}</FieldTitle>
      <FieldDescription>
        {t.description} ({t.currency}
        <span className="font-medium tabular-nums">
          {formatNumber(value[0], t.locale)}
        </span>{" "}
        -{" "}
        <span className="font-medium tabular-nums">
          {formatNumber(value[1], t.locale)}
        </span>
        ).
      </FieldDescription>
      <Slider
        value={value}
        onValueChange={(value) => setValue(value as [number, number])}
        max={1000}
        min={0}
        step={10}
        className="mt-2 w-full"
        aria-label={t.ariaLabel}
      />
    </Field>
  )
}

Subdomains

Dependencies

  • field
  • language-selector
  • react
  • slider

Frequently Asked Questions

What does field-slider.tsx do?
field-slider.tsx is a source file in the ui codebase, written in tsx. It belongs to the Internationalization domain, Dictionary subdomain.
What functions are defined in field-slider.tsx?
field-slider.tsx defines 2 function(s): FieldSlider, formatNumber.
What does field-slider.tsx depend on?
field-slider.tsx imports 4 module(s): field, language-selector, react, slider.
What files import field-slider.tsx?
field-slider.tsx is imported by 1 file(s): index.tsx.
Where is field-slider.tsx in the architecture?
field-slider.tsx is located at apps/v4/app/(app)/examples/rtl/components/field-slider.tsx (domain: Internationalization, subdomain: Dictionary, directory: apps/v4/app/(app)/examples/rtl/components).

Analyze Your Own Codebase

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

Try Supermodel Free