Arabic - Text.jsx

export default ArabicText; /* components/ArabicText.css */ .arabic-text display: inline-block; font-family: 'Segoe UI', 'Tahoma', 'Noto Sans Arabic', 'Amiri', 'Droid Arabic Naskh', 'Traditional Arabic', sans-serif; unicode-bidi: embed; word-wrap: break-word; white-space: normal;

// components/ArabicText.jsx import React from 'react'; const ArabicText = ( children, className, ...props ) => return ( <span dir="rtl" lang="ar" className= arabic-text $className ...props > children </span> ); ;

return String(text).replace(/\d/g, (digit) => westernToEastern[digit]); ; Arabic Text.jsx

const styles = ;

function ArabicInput() return ( <label> <ArabicText>الاسم الكامل:</ArabicText> <input type="text" dir="rtl" lang="ar" placeholder="أدخل اسمك" /> </label> ); export default ArabicText; /* components/ArabicText

The ArabicText.jsx component is a simple but powerful tool for handling Arabic text in React applications. By encapsulating RTL direction, font styling, and number formatting, it ensures consistent and accessible rendering of Arabic content across your application.

// components/ArabicText.jsx import React from 'react'; import './ArabicText.css'; const ArabicText = ( children, size = 'medium', weight = 'normal', lineHeight = 'normal', className = '', ...props ) => Auto-detect and Format Numbers // Advanced ArabicText with

function ProductCard() return ( <div> <ArabicText> سعر المنتج: $49.99 </ArabicText> /* Renders as: سعر المنتج: ٤٩.٩٩ $ */ </div> );

/* For small UI elements */ .arabic-text.ui-text font-size: 0.875rem; line-height: 1.4;

1. Auto-detect and Format Numbers // Advanced ArabicText with number conversion const ArabicText = ( children, useArabicNumerals = true, ...props ) => const convertToArabicNumerals = (text) => const westernToEastern = '0': '٠', '1': '١', '2': '٢', '3': '٣', '4': '٤', '5': '٥', '6': '٦', '7': '٧', '8': '٨', '9': '٩' ;