-
Notifications
You must be signed in to change notification settings - Fork 0
/
GLink.tsx
39 lines (32 loc) · 902 Bytes
/
GLink.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { styled } from '@mui/material';
import { useGContext } from '../GContext';
import Links from './Links';
import { LinkProps, LinkVariants } from './types.ts';
const LinkContainer = styled('span')<{ variant: LinkVariants }>`
&:before {
content: ' ';
display: inline-block;
left: -0.5em;
}
&:after {
content: ' ';
display: inline-block;
right: -0.5em;
}
${(props) => Links[props.variant]};
`;
const GLink = (props: LinkProps) => {
const { link } = useGContext();
const { className, onClick, children, variant = link?.variant, sx } = props;
return (
<LinkContainer
className={`g-link ${className || ''}`}
onClick={onClick}
variant={variant as LinkVariants}
sx={sx}
>
{children}
</LinkContainer>
);
};
export default GLink;