From 5fa0684ff39b7988a99a02050abaec573b06c7ee Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 20:11:59 +0000 Subject: [PATCH] Update src/components/shared/SvgTextLogo/SvgTextLogo.tsx --- .../shared/SvgTextLogo/SvgTextLogo.tsx | 77 +++++++++++-------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/src/components/shared/SvgTextLogo/SvgTextLogo.tsx b/src/components/shared/SvgTextLogo/SvgTextLogo.tsx index f214190..1afc46e 100644 --- a/src/components/shared/SvgTextLogo/SvgTextLogo.tsx +++ b/src/components/shared/SvgTextLogo/SvgTextLogo.tsx @@ -1,51 +1,60 @@ -"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; + fontSize?: number; + fontWeight?: number | string; + fontFamily?: string; + fill?: string; className?: string; } -const SvgTextLogo = memo(function SvgTextLogo({ - logoText, - adjustHeightFactor, - verticalAlign = "top", - className = "", -}) { - const { svgRef, textRef, viewBox, aspectRatio } = useSvgTextLogo(logoText, false, adjustHeightFactor); +export const SvgTextLogo: React.FC = ({ + text, + fontSize = 48, + fontWeight = 'bold', + fontFamily = 'Arial, sans-serif', + fill = 'currentColor', + className = '', +}) => { + const textRef = React.useRef(null); + const [bbox, setBbox] = React.useState({ width: 0, height: 0 }); + + React.useEffect(() => { + if (textRef.current) { + const boundingBox = textRef.current.getBBox(); + setBbox({ + width: boundingBox.width, + height: boundingBox.height, + }); + } + }, [text, fontSize]); + + const padding = 20; + const viewBoxWidth = bbox.width + padding * 2; + const viewBoxHeight = bbox.height + padding * 2; return ( - {logoText} + {text} ); -}); - -SvgTextLogo.displayName = "SvgTextLogo"; +}; export default SvgTextLogo; -- 2.49.1