saleor-dashboard/src/components/ExternalLink/ExternalLink.tsx

37 lines
893 B
TypeScript
Raw Normal View History

2019-06-19 14:40:52 +00:00
import { createStyles, withStyles, WithStyles } from "@material-ui/core/styles";
import Typography, { TypographyProps } from "@material-ui/core/Typography";
2019-08-09 10:26:22 +00:00
import React from "react";
2019-06-19 14:40:52 +00:00
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;