Update src/components/shared/SvgTextLogo/SvgTextLogo.tsx
This commit is contained in:
@@ -6,6 +6,7 @@ interface SvgTextLogoProps {
|
||||
fontSize?: number;
|
||||
fontWeight?: number | string;
|
||||
letterSpacing?: number;
|
||||
fill?: string;
|
||||
}
|
||||
|
||||
const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
|
||||
@@ -14,27 +15,28 @@ const SvgTextLogo: React.FC<SvgTextLogoProps> = ({
|
||||
fontSize = 48,
|
||||
fontWeight = 700,
|
||||
letterSpacing = 0,
|
||||
fill = 'currentColor',
|
||||
}) => {
|
||||
const svgWidth = text.length * (fontSize * 0.6) + 40;
|
||||
const svgHeight = fontSize + 20;
|
||||
const textLength = text.length;
|
||||
const charWidth = fontSize * 0.6;
|
||||
const width = charWidth * textLength + letterSpacing * (textLength - 1);
|
||||
const height = fontSize * 1.2;
|
||||
|
||||
return (
|
||||
<svg
|
||||
width={svgWidth}
|
||||
height={svgHeight}
|
||||
viewBox={`0 0 ${svgWidth} ${svgHeight}`}
|
||||
viewBox={`0 0 ${width} ${height}`}
|
||||
className={className}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
>
|
||||
<text
|
||||
x="20"
|
||||
y={fontSize + 5}
|
||||
x="0"
|
||||
y={fontSize}
|
||||
fontSize={fontSize}
|
||||
fontWeight={fontWeight}
|
||||
fill={fill}
|
||||
letterSpacing={letterSpacing}
|
||||
fill="currentColor"
|
||||
dominantBaseline="alphabetic"
|
||||
textAnchor="start"
|
||||
dominantBaseline="middle"
|
||||
>
|
||||
{text}
|
||||
</text>
|
||||
|
||||
Reference in New Issue
Block a user