Portfolio/front/FerorIcon.ts

45 lines
4.7 KiB
TypeScript
Raw Normal View History

import { newLine } from ".";
const icon = `
*,
,*
,,
.*
**
*
,,,,
,, ..*
,.. .*
/. *
,., .,
... ..
/ /.
. *.
.. .,.
,, .,
/ /.
... ,.. ,.
..* ., ..
., . ,.,
. *.. *.
.., ,, ..
`;
interface FerorIconProps {
width: number;
}
const FerorIcon = ({ width }: FerorIconProps) => {
const iconLines = icon.split("\n").filter((line) => line.trim() !== "");
const iconWidth = iconLines[0]!.length;
// On va ajouter des espaces pour centrer l'icône
const numberOfSpaces = Math.floor((width - iconWidth) / 2);
const spaces = " ".repeat(numberOfSpaces);
return iconLines.map((line) => `${spaces}${line}`).join(newLine);
};
export default FerorIcon;