Merge version_1 into main #1

Merged
bender merged 2 commits from version_1 into main 2026-03-12 06:11:34 +00:00
2 changed files with 39 additions and 35 deletions

View File

@@ -72,6 +72,7 @@ export default function LandingPage() {
imageAlt="Coffee roasting process and café ambiance"
useInvertedBackground={false}
mediaAnimation="slide-up"
metricsAnimation="slide-up"
/>
</div>

View File

@@ -1,51 +1,54 @@
"use client";
import { memo } from "react";
import useSvgTextLogo from "./useSvgTextLogo";
import { cls } from "@/lib/utils";
import React, { useMemo } from 'react';
interface SvgTextLogoProps {
logoText: string;
adjustHeightFactor?: number;
verticalAlign?: "top" | "center";
text: string;
className?: string;
textClassName?: string;
}
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,
className = '',
textClassName = '',
}) => {
const textLength = useMemo(() => {
if (typeof document === 'undefined') return text.length * 10;
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
if (!ctx) return text.length * 10;
ctx.font = '48px Arial';
return ctx.measureText(text).width;
}, [text]);
const pathLength = useMemo(() => Math.ceil(textLength + 40), [textLength]);
return (
<svg
ref={svgRef}
viewBox={viewBox}
className={cls("w-full", className)}
style={{ aspectRatio: aspectRatio }}
preserveAspectRatio="none"
role="img"
aria-label={`${logoText} logo`}
className={className}
viewBox={`0 0 ${pathLength} 120`}
preserveAspectRatio="xMidYMid meet"
xmlns="http://www.w3.org/2000/svg"
>
<defs>
<path
id="textPath"
d={`M 20,60 L ${pathLength - 20},60`}
fill="none"
/>
</defs>
<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"
}}
className={textClassName}
fontSize="48"
fontWeight="bold"
fill="currentColor"
dominantBaseline="middle"
>
{logoText}
<textPath href="#textPath" startOffset="50%" textAnchor="middle">
{text}
</textPath>
</text>
</svg>
);
});
SvgTextLogo.displayName = "SvgTextLogo";
};
export default SvgTextLogo;