This repository has no description
1.2 kB
51 lines
1import { Anchor, Box, Tooltip } from '@mantine/core';
2import { MouseEvent } from 'react';
3
4interface Props {
5 size?: number;
6 marginUrl?: string | null;
7 tooltipText?: string;
8}
9
10export default function MarginLogo({
11 size = 16,
12 marginUrl,
13 tooltipText = 'View on Margin',
14}: Props) {
15 const handleClick = (e: MouseEvent) => {
16 e.stopPropagation();
17 };
18
19 const logo = (
20 <Box
21 component="svg"
22 width={size}
23 height={size}
24 viewBox="0 0 265 231"
25 fill="#027bff"
26 xmlns="http://www.w3.org/2000/svg"
27 style={{ display: 'inline-block', verticalAlign: 'middle' }}
28 >
29 <path d="M0 230 V0 H199 V65.7156 H149.5 V115.216 H182.5 L199 131.716 V230 Z" />
30 <path d="M215 214.224 V230 H264.5 V0 H215 V16.2242 H248.5 V214.224 H215 Z" />
31 </Box>
32 );
33
34 if (!marginUrl) {
35 return logo;
36 }
37
38 return (
39 <Tooltip label={tooltipText}>
40 <Anchor
41 href={marginUrl}
42 target="_blank"
43 rel="noopener noreferrer"
44 onClick={handleClick}
45 style={{ display: 'inline-flex', alignItems: 'center', lineHeight: 0 }}
46 >
47 {logo}
48 </Anchor>
49 </Tooltip>
50 );
51}