dhre-ui-kit 0.0.382 → 0.0.384

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.mjs CHANGED
@@ -347,20 +347,16 @@ const CustomTypography = ({
347
347
  translateToArabic = false,
348
348
  ...props
349
349
  }) => {
350
- const [translatedText, setTranslatedText] = useState(text || "");
350
+ const [translatedText, setTranslatedText] = useState();
351
351
  const textStyle = FONT_STYLES[variant];
352
352
  useEffect(() => {
353
353
  const translateText = async () => {
354
- if (!translateToArabic || !text || text.trim() === "") {
355
- setTranslatedText(text || "");
356
- return;
357
- }
358
354
  try {
359
- const res = await translate(text, { to: "ar" });
360
- setTranslatedText(res.text);
355
+ const res = await translate(text ?? "", { to: "ar" });
356
+ setTranslatedText(res?.text);
361
357
  } catch (error) {
362
358
  console.error("Translation error:", error);
363
- setTranslatedText(text);
359
+ setTranslatedText(JSON.stringify(error));
364
360
  }
365
361
  };
366
362
  translateText();