From e0be3271102babd22becb9a0be0a0898ef53b26e Mon Sep 17 00:00:00 2001 From: bender Date: Tue, 10 Mar 2026 19:39:07 +0000 Subject: [PATCH] Update src/components/shared/SvgTextLogo/SvgTextLogo.tsx --- .../shared/SvgTextLogo/SvgTextLogo.tsx | 92 +++++++++++-------- 1 file changed, 53 insertions(+), 39 deletions(-) diff --git a/src/components/shared/SvgTextLogo/SvgTextLogo.tsx b/src/components/shared/SvgTextLogo/SvgTextLogo.tsx index f214190..0f2ad09 100644 --- a/src/components/shared/SvgTextLogo/SvgTextLogo.tsx +++ b/src/components/shared/SvgTextLogo/SvgTextLogo.tsx @@ -1,51 +1,65 @@ -"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; + fontSize?: number; + letterSpacing?: number; + strokeWidth?: number; + fillColor?: string; + strokeColor?: 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 = '', + fontSize = 48, + letterSpacing = 2, + strokeWidth = 1, + fillColor = '#000000', + strokeColor = '#ffffff', +}) => { + const getLetterPositions = (text: string, fontSize: number, letterSpacing: number) => { + const letters = text.split(''); + let xPos = 0; + const positions = letters.map((letter) => { + const charWidth = fontSize * 0.6; + const pos = xPos; + xPos += charWidth + letterSpacing; + return { letter, x: pos }; + }); + return positions; + }; + + const positions = getLetterPositions(text, fontSize, letterSpacing); + const totalWidth = positions.length > 0 ? positions[positions.length - 1].x + fontSize * 0.6 : 0; + const totalHeight = fontSize * 1.5; return ( - - {logoText} - + {positions.map((pos, idx) => ( + + {pos.letter} + + ))} ); -}); +}; -SvgTextLogo.displayName = "SvgTextLogo"; - -export default SvgTextLogo; +export default SvgTextLogo; \ No newline at end of file -- 2.49.1