Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a6c40e50f | |||
| 4987347dbe | |||
| 5d3523849c |
@@ -203,4 +203,4 @@ export default function LandingPage() {
|
|||||||
</div>
|
</div>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
--background: #ffffff;
|
--background: #ffffff;
|
||||||
--card: #f9f9f9;
|
--card: #f9f9f9;
|
||||||
--foreground: #000f06e6;
|
--foreground: #000612e6;
|
||||||
--primary-cta: #0a7039;
|
--primary-cta: #15479c;
|
||||||
--primary-cta-text: #ffffff;
|
--primary-cta-text: #ffffff;
|
||||||
--secondary-cta: #f9f9f9;
|
--secondary-cta: #f9f9f9;
|
||||||
--secondary-cta-text: #000f06e6;
|
--secondary-cta-text: #000f06e6;
|
||||||
|
|||||||
@@ -1,51 +1,47 @@
|
|||||||
"use client";
|
import React from 'react';
|
||||||
|
|
||||||
import { memo } from "react";
|
|
||||||
import useSvgTextLogo from "./useSvgTextLogo";
|
|
||||||
import { cls } from "@/lib/utils";
|
|
||||||
|
|
||||||
interface SvgTextLogoProps {
|
interface SvgTextLogoProps {
|
||||||
logoText: string;
|
text: string;
|
||||||
adjustHeightFactor?: number;
|
|
||||||
verticalAlign?: "top" | "center";
|
|
||||||
className?: string;
|
className?: string;
|
||||||
|
fontSize?: number;
|
||||||
|
fontWeight?: number | string;
|
||||||
|
letterSpacing?: number;
|
||||||
|
fill?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SvgTextLogo = memo<SvgTextLogoProps>(function SvgTextLogo({
|
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
|
||||||
logoText,
|
text,
|
||||||
adjustHeightFactor,
|
className = '',
|
||||||
verticalAlign = "top",
|
fontSize = 48,
|
||||||
className = "",
|
fontWeight = 700,
|
||||||
}) {
|
letterSpacing = 0,
|
||||||
const { svgRef, textRef, viewBox, aspectRatio } = useSvgTextLogo(logoText, false, adjustHeightFactor);
|
fill = 'currentColor',
|
||||||
|
}) => {
|
||||||
|
const textLength = text.length;
|
||||||
|
const charWidth = fontSize * 0.6;
|
||||||
|
const width = charWidth * textLength + letterSpacing * (textLength - 1);
|
||||||
|
const height = fontSize * 1.2;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
ref={svgRef}
|
viewBox={`0 0 ${width} ${height}`}
|
||||||
viewBox={viewBox}
|
className={className}
|
||||||
className={cls("w-full", className)}
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
style={{ aspectRatio: aspectRatio }}
|
preserveAspectRatio="xMidYMid meet"
|
||||||
preserveAspectRatio="none"
|
|
||||||
role="img"
|
|
||||||
aria-label={`${logoText} logo`}
|
|
||||||
>
|
>
|
||||||
<text
|
<text
|
||||||
ref={textRef}
|
|
||||||
x="0"
|
x="0"
|
||||||
y={verticalAlign === "center" ? "50%" : "0"}
|
y={fontSize}
|
||||||
className="font-bold fill-current"
|
fontSize={fontSize}
|
||||||
style={{
|
fontWeight={fontWeight}
|
||||||
fontSize: "20px",
|
fill={fill}
|
||||||
letterSpacing: "-0.02em",
|
letterSpacing={letterSpacing}
|
||||||
dominantBaseline: verticalAlign === "center" ? "middle" : "text-before-edge"
|
dominantBaseline="middle"
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{logoText}
|
{text}
|
||||||
</text>
|
</text>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
});
|
};
|
||||||
|
|
||||||
SvgTextLogo.displayName = "SvgTextLogo";
|
|
||||||
|
|
||||||
export default SvgTextLogo;
|
export default SvgTextLogo;
|
||||||
|
|||||||
Reference in New Issue
Block a user