/* For small UI elements */ .arabic-text.ui-text font-size: 0.875rem; line-height: 1.4;
return ( <span dir="rtl" lang="ar" style=styles className= arabic-text $className ...props > children </span> ); ;
; checkFont(); , []);
const formattedContent = useArabicNumerals ? convertToArabicNumerals(children) : children;
const ArabicText = ( children, ...props ) => const fontLoaded = useArabicFont(); Arabic Text.jsx
function ProductCard() return ( <div> <ArabicText> سعر المنتج: $49.99 </ArabicText> /* Renders as: سعر المنتج: ٤٩.٩٩ $ */ </div> );
useEffect(() => // Check if Arabic font is supported const checkFont = async () => if ('fonts' in document) await document.fonts.ready; setFontLoaded(true); /* For small UI elements */
// components/ArabicText.jsx import React from 'react'; import './ArabicText.css'; const ArabicText = ( children, size = 'medium', weight = 'normal', lineHeight = 'normal', className = '', ...props ) =>