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

field-hear.tsx — ui Source File

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

File tsx Internationalization Dictionary 4 imports 1 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  067a24f4_f10d_f4a0_456e_e652544d6590["field-hear.tsx"]
  3f7abb04_1707_b324_1349_fc528ddbfb88["card"]
  067a24f4_f10d_f4a0_456e_e652544d6590 --> 3f7abb04_1707_b324_1349_fc528ddbfb88
  cc83a0fe_5b64_ae51_20ef_2b5653e9e45f["checkbox"]
  067a24f4_f10d_f4a0_456e_e652544d6590 --> cc83a0fe_5b64_ae51_20ef_2b5653e9e45f
  7e9c1e20_5a8a_4152_90a3_40c280dc340e["field"]
  067a24f4_f10d_f4a0_456e_e652544d6590 --> 7e9c1e20_5a8a_4152_90a3_40c280dc340e
  2c1404ab_bf28_6225_f9a0_b9e29400c66c["language-selector"]
  067a24f4_f10d_f4a0_456e_e652544d6590 --> 2c1404ab_bf28_6225_f9a0_b9e29400c66c
  a20493d4_39f4_bced_97b9_027078a02a91["index.tsx"]
  a20493d4_39f4_bced_97b9_027078a02a91 --> 067a24f4_f10d_f4a0_456e_e652544d6590
  style 067a24f4_f10d_f4a0_456e_e652544d6590 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import { Card, CardContent } from "@/examples/base/ui-rtl/card"
import { Checkbox } from "@/examples/base/ui-rtl/checkbox"
import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,
  FieldLegend,
  FieldSet,
  FieldTitle,
} from "@/examples/base/ui-rtl/field"

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

const translations = {
  ar: {
    dir: "rtl" as const,
    legend: "كيف سمعت عنا؟",
    description: "اختر الخيار الذي يصف أفضل طريقة سمعت عنا من خلالها.",
    socialMedia: "التواصل الاجتماعي",
    searchEngine: "البحث",
    referral: "إحالة",
    other: "أخرى",
  },
  he: {
    dir: "rtl" as const,
    legend: "איך שמעת עלינו?",
    description: "בחר את האפשרות שמתארת בצורה הטובה ביותר כיצד שמעת עלינו.",
    socialMedia: "חברתיות",
    searchEngine: "חיפוש",
    referral: "הפניה",
    other: "אחר",
  },
}

export function FieldHear() {
  const context = useLanguageContext()
  const lang = context?.language === "he" ? "he" : "ar"
  const t = translations[lang]

  const options = [
    { label: t.socialMedia, value: "social-media" },
    { label: t.searchEngine, value: "search-engine" },
    { label: t.referral, value: "referral" },
    { label: t.other, value: "other" },
  ]

  return (
    <div dir={t.dir}>
      <Card className="border-0 py-4 shadow-none">
        <CardContent className="px-4">
          <form>
            <FieldGroup>
              <FieldSet className="gap-4">
                <FieldLegend>{t.legend}</FieldLegend>
                <FieldDescription className="line-clamp-1">
                  {t.description}
                </FieldDescription>
                <FieldGroup className="flex flex-row flex-wrap gap-2 [--radius:9999rem]">
                  {options.map((option) => (
                    <FieldLabel
                      htmlFor={`rtl-${option.value}`}
                      key={option.value}
                      className="!w-fit"
                    >
                      <Field
                        orientation="horizontal"
                        className="gap-1.5 overflow-hidden px-3! py-1.5! transition-all duration-100 ease-linear group-has-data-[state=checked]/field-label:px-2!"
                      >
                        <Checkbox
                          value={option.value}
                          id={`rtl-${option.value}`}
                          defaultChecked={option.value === "social-media"}
                          className="-ms-6 translate-x-1 rounded-full transition-all duration-100 ease-linear data-checked:ms-0 data-checked:translate-x-0"
                        />
                        <FieldTitle>{option.label}</FieldTitle>
                      </Field>
                    </FieldLabel>
                  ))}
                </FieldGroup>
              </FieldSet>
            </FieldGroup>
          </form>
        </CardContent>
      </Card>
    </div>
  )
}

Subdomains

Functions

Dependencies

  • card
  • checkbox
  • field
  • language-selector

Frequently Asked Questions

What does field-hear.tsx do?
field-hear.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-hear.tsx?
field-hear.tsx defines 1 function(s): FieldHear.
What does field-hear.tsx depend on?
field-hear.tsx imports 4 module(s): card, checkbox, field, language-selector.
What files import field-hear.tsx?
field-hear.tsx is imported by 1 file(s): index.tsx.
Where is field-hear.tsx in the architecture?
field-hear.tsx is located at apps/v4/app/(app)/examples/rtl/components/field-hear.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