Merge version_1 into main #1

Merged
bender merged 1 commits from version_1 into main 2026-03-11 13:23:26 +00:00

View File

@@ -1,51 +1,51 @@
"use client";
import React, { SVGProps } from 'react';
import { memo } from "react";
import useSvgTextLogo from "./useSvgTextLogo";
import { cls } from "@/lib/utils";
interface SvgTextLogoProps {
logoText: string;
adjustHeightFactor?: number;
verticalAlign?: "top" | "center";
className?: string;
interface SvgTextLogoProps extends SVGProps<SVGSVGElement> {
text?: string;
fontSize?: number;
fontFamily?: string;
fontWeight?: number | string;
letterSpacing?: number;
textAnchor?: 'start' | 'middle' | 'end';
dominantBaseline?: 'auto' | 'middle' | 'hanging';
}
const SvgTextLogo = memo<SvgTextLogoProps>(function SvgTextLogo({
logoText,
adjustHeightFactor,
verticalAlign = "top",
className = "",
}) {
const { svgRef, textRef, viewBox, aspectRatio } = useSvgTextLogo(logoText, false, adjustHeightFactor);
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
text = 'LOGO',
fontSize = 48,
fontFamily = 'Arial, sans-serif',
fontWeight = 'bold',
letterSpacing = 2,
textAnchor = 'middle',
dominantBaseline = 'middle',
width = '200',
height = '100',
viewBox = '0 0 200 100',
...props
}) => {
return (
<svg
ref={svgRef}
viewBox={viewBox}
className={cls("w-full", className)}
style={{ aspectRatio: aspectRatio }}
preserveAspectRatio="none"
role="img"
aria-label={`${logoText} logo`}
width={width}
height={height}
viewBox={viewBox as string}
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<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"
}}
x="50%"
y="50%"
fontSize={fontSize}
fontFamily={fontFamily}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
textAnchor={textAnchor}
dominantBaseline={dominantBaseline}
fill="currentColor"
>
{logoText}
{text}
</text>
</svg>
);
});
SvgTextLogo.displayName = "SvgTextLogo";
};
export default SvgTextLogo;