Merge version_1 into main #2

Merged
bender merged 1 commits from version_1 into main 2026-03-12 18:29:11 +00:00

View File

@@ -1,51 +1,52 @@
"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;
}
const SvgTextLogo = memo<SvgTextLogoProps>(function SvgTextLogo({
logoText,
adjustHeightFactor,
verticalAlign = "top",
className = "",
}) {
const { svgRef, textRef, viewBox, aspectRatio } = useSvgTextLogo(logoText, false, adjustHeightFactor);
export const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text,
className = '',
textClassName = '',
svgClassName = '',
}) => {
const id = React.useMemo(() => `textPath-${Math.random().toString(36).substr(2, 9)}`, []);
return (
<svg
ref={svgRef}
viewBox={viewBox}
className={cls("w-full", className)}
style={{ aspectRatio: aspectRatio }}
preserveAspectRatio="none"
role="img"
aria-label={`${logoText} logo`}
>
<text
ref={textRef}
x="0"
y={verticalAlign === "center" ? "50%" : "0"}
className="font-bold fill-current"
style={{
fontSize: "20px",
letterSpacing: "-0.02em",
dominantBaseline: verticalAlign === "center" ? "middle" : "text-before-edge"
}}
<div className={`flex items-center justify-center ${className}`}>
<svg
viewBox="0 0 800 200"
className={`w-full h-auto ${svgClassName}`}
xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid meet"
>
{logoText}
</text>
</svg>
<defs>
<style>
{`
.svg-text-logo-text {
font-size: 72px;
font-weight: bold;
fill: currentColor;
letter-spacing: 2px;
}
`}
</style>
</defs>
<text
x="50%"
y="50%"
textAnchor="middle"
dominantBaseline="central"
className={`svg-text-logo-text ${textClassName}`}
>
{text}
</text>
</svg>
</div>
);
});
SvgTextLogo.displayName = "SvgTextLogo";
};
export default SvgTextLogo;