From 27ef107ec919c36dc6f940f1910f942cae529148 Mon Sep 17 00:00:00 2001 From: bender Date: Thu, 12 Mar 2026 14:55:27 +0000 Subject: [PATCH] Update src/components/shared/SvgTextLogo/SvgTextLogo.tsx --- .../shared/SvgTextLogo/SvgTextLogo.tsx | 100 +++++++++++------- 1 file changed, 60 insertions(+), 40 deletions(-) diff --git a/src/components/shared/SvgTextLogo/SvgTextLogo.tsx b/src/components/shared/SvgTextLogo/SvgTextLogo.tsx index f214190..9226a3e 100644 --- a/src/components/shared/SvgTextLogo/SvgTextLogo.tsx +++ b/src/components/shared/SvgTextLogo/SvgTextLogo.tsx @@ -1,51 +1,71 @@ -"use client"; - -import { memo } from "react"; -import useSvgTextLogo from "./useSvgTextLogo"; -import { cls } from "@/lib/utils"; +import React from 'react'; interface SvgTextLogoProps { - logoText: string; - adjustHeightFactor?: number; - verticalAlign?: "top" | "center"; + text: string; className?: string; + textClassName?: string; + svgClassName?: string; + fontSize?: number; + letterSpacing?: number; + fontWeight?: number | string; + fill?: string; } -const SvgTextLogo = memo(function SvgTextLogo({ - logoText, - adjustHeightFactor, - verticalAlign = "top", - className = "", -}) { - const { svgRef, textRef, viewBox, aspectRatio } = useSvgTextLogo(logoText, false, adjustHeightFactor); +const SvgTextLogo: React.FC = ({ + text, + className = '', + textClassName = '', + svgClassName = '', + fontSize = 48, + letterSpacing = 0, + fontWeight = 'bold', + fill = 'currentColor', +}) => { + const textRef = React.useRef(null); + const [dimensions, setDimensions] = React.useState({ width: 400, height: 100 }); + + React.useEffect(() => { + if (textRef.current) { + try { + const bbox = textRef.current.getBBox(); + setDimensions({ + width: Math.ceil(bbox.width) + 20, + height: Math.ceil(bbox.height) + 20, + }); + } catch (e) { + // SVG not yet rendered, use defaults + } + } + }, [text, fontSize, letterSpacing, fontWeight]); return ( - - + - {logoText} - - + + {text} + + + ); -}); - -SvgTextLogo.displayName = "SvgTextLogo"; +}; export default SvgTextLogo;