Merge version_1 into main #1

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

View File

@@ -1,51 +1,52 @@
"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";
interface SvgTextLogoProps extends SVGProps<SVGSVGElement> {
text?: string;
fontSize?: number;
fontWeight?: 'normal' | 'bold' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
letterSpacing?: number;
fill?: string;
className?: string;
}
const SvgTextLogo = memo<SvgTextLogoProps>(function SvgTextLogo({
logoText,
adjustHeightFactor,
verticalAlign = "top",
className = "",
}) {
const { svgRef, textRef, viewBox, aspectRatio } = useSvgTextLogo(logoText, false, adjustHeightFactor);
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"
}}
const SvgTextLogo = React.forwardRef<SVGSVGElement, SvgTextLogoProps>(
(
{
text = 'Logo',
fontSize = 24,
fontWeight = 'bold',
letterSpacing = 0,
fill = 'currentColor',
className = '',
...props
},
ref
) => {
return (
<svg
ref={ref}
viewBox="0 0 200 50"
xmlns="http://www.w3.org/2000/svg"
className={className}
{...props}
>
{logoText}
</text>
</svg>
);
});
<text
x="100"
y="35"
textAnchor="middle"
dominantBaseline="middle"
fontSize={fontSize}
fontWeight={fontWeight}
letterSpacing={letterSpacing}
fill={fill}
>
{text}
</text>
</svg>
);
}
);
SvgTextLogo.displayName = "SvgTextLogo";
SvgTextLogo.displayName = 'SvgTextLogo';
export default SvgTextLogo;