saleor-dashboard/src/components/ExternalLink/ExternalLink.tsx
2019-08-09 12:26:22 +02:00

36 lines
893 B
TypeScript

import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
import Typography, { TypographyProps } from "@material-ui/core/Typography";
import React from "react";
const styles = createStyles({
link: {
textDecoration: "none"
}
});
interface ExternalLinkProps
extends React.HTMLProps<HTMLAnchorElement>,
WithStyles<typeof styles> {
href: string;
className?: string;
typographyProps?: TypographyProps;
}
const ExternalLink = withStyles(styles, { name: "ExternalLink" })(
({
classes,
className,
children,
href,
typographyProps,
...props
}: ExternalLinkProps) => (
<a href={href} className={classes.link} {...props}>
<Typography className={className} color="primary" {...typographyProps}>
{children}
</Typography>
</a>
)
);
ExternalLink.displayName = "ExternalLink";
export default ExternalLink;