From fb252c5347aa7e777904fe109164c8e7c36c0b61 Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 18:31:56 +0000 Subject: [PATCH] Update src/components/shared/SvgTextLogo/SvgTextLogo.tsx --- .../shared/SvgTextLogo/SvgTextLogo.tsx | 95 +++++++++++-------- 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/src/components/shared/SvgTextLogo/SvgTextLogo.tsx b/src/components/shared/SvgTextLogo/SvgTextLogo.tsx index f214190..5fa0749 100644 --- a/src/components/shared/SvgTextLogo/SvgTextLogo.tsx +++ b/src/components/shared/SvgTextLogo/SvgTextLogo.tsx @@ -1,51 +1,64 @@ -"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; + fontFamily?: string; + fontWeight?: number | string; + letterSpacing?: number; className?: string; + textAnchor?: 'start' | 'middle' | 'end'; + dominantBaseline?: 'auto' | 'middle' | 'hanging'; } -const SvgTextLogo = memo(function SvgTextLogo({ - logoText, - adjustHeightFactor, - verticalAlign = "top", - className = "", -}) { - const { svgRef, textRef, viewBox, aspectRatio } = useSvgTextLogo(logoText, false, adjustHeightFactor); +const SvgTextLogo = React.forwardRef( + ( + { + text, + fontSize = 48, + fontFamily = 'system-ui, -apple-system, sans-serif', + fontWeight = 700, + letterSpacing = 0, + className = '', + textAnchor = 'middle', + dominantBaseline = 'middle', + }, + ref + ) => { + const padding = 20; + const estimatedWidth = text.length * fontSize * 0.6; + const estimatedHeight = fontSize * 1.2; + const width = estimatedWidth + padding * 2; + const height = estimatedHeight + padding * 2; - return ( - - - {logoText} - - - ); -}); + + {text} + + + ); + } +); -SvgTextLogo.displayName = "SvgTextLogo"; +SvgTextLogo.displayName = 'SvgTextLogo'; export default SvgTextLogo;