fix(striker-ui): simplify children in Link

main
Tsu-ba-me 2 years ago
parent e1c5cb6946
commit 9d171ee607
  1. 41
      striker-ui/components/Link.tsx
  2. 1
      striker-ui/types/Link.d.ts

@ -1,39 +1,26 @@
import { Link as MUILinkIcon } from '@mui/icons-material';
import { Link as MUILink } from '@mui/material';
import { FC } from 'react';
import {
Box as MUIBox,
Link as MUILink,
LinkProps as MUILinkProps,
} from '@mui/material';
import { Link as LinkIcon } from '@mui/icons-material';
import { GREY, TEXT } from '../lib/consts/DEFAULT_THEME';
export type LinkProps = MUILinkProps;
import FlexBox from './FlexBox';
const Link: FC<LinkProps> = ({ children, sx, ...restLinkProps }) => (
const Link: FC<LinkProps> = ({ children, sx: linkSx, ...restLinkProps }) => (
<MUILink
{...{
underline: 'hover',
variant: 'subtitle1',
...restLinkProps,
sx: {
color: TEXT,
textDecorationColor: GREY,
...sx,
},
underline="hover"
variant="subtitle1"
{...restLinkProps}
sx={{
color: TEXT,
textDecorationColor: GREY,
...linkSx,
}}
>
<MUIBox
sx={{
alignItems: 'center',
display: 'flex',
flexDirection: 'row',
}}
>
<FlexBox row>
{children}
<LinkIcon sx={{ marginLeft: '.3em' }} />
</MUIBox>
<MUILinkIcon sx={{ marginLeft: '.3em' }} />
</FlexBox>
</MUILink>
);

@ -0,0 +1 @@
type LinkProps = import('@mui/material').LinkProps;
Loading…
Cancel
Save