Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
samiramkr committed Dec 21, 2020
1 parent fba3acf commit 7358a60
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/
import React from 'react';
import { IconLinkVertical } from './IconLinkVertical';
import { HeaderIconLink } from './types';
import { IconLinkVertical, IconLinkVerticalProps } from './IconLinkVertical';
import { makeStyles } from '@material-ui/core';

const useStyles = makeStyles(theme => ({
Expand All @@ -29,7 +28,7 @@ const useStyles = makeStyles(theme => ({
}));

type Props = {
links: HeaderIconLink[];
links: IconLinkVerticalProps[];
};

export const HeaderIconLinkRow = ({ links }: Props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import { makeStyles, Link } from '@material-ui/core';
import LinkIcon from '@material-ui/icons/Link';
import { Link as RouterLink } from '../Link';

type IconLinkVerticalProps = {
export type IconLinkVerticalProps = {
icon?: React.ReactNode;
href?: string;
disabled?: boolean;
title?: string;
label: string;
action?: React.ReactNode;
};
Expand Down Expand Up @@ -63,7 +62,6 @@ export function IconLinkVertical({
<Link
className={classnames(classes.link, classes.disabled)}
underline="none"
title={props.title}
{...props}
>
{icon}
Expand All @@ -74,27 +72,13 @@ export function IconLinkVertical({

if (action) {
return (
<Link
className={classnames(classes.link, classes.linkStyle)}
href={href}
{...props}
>
<Link className={classnames(classes.link, classes.linkStyle)} {...props}>
{icon}
{action}
</Link>
);
}

// Absolute links should not be using RouterLink
if (href?.startsWith('//') || href?.includes('://')) {
return (
<Link className={classes.link} href={href} {...props}>
{icon}
<span className={classes.label}>{props.label}</span>
</Link>
);
}

return (
<Link className={classes.link} to={href} component={RouterLink} {...props}>
{icon}
Expand Down
24 changes: 0 additions & 24 deletions packages/core/src/components/HeaderIconLinkRow/types.ts

This file was deleted.

0 comments on commit 7358a60

Please sign in to comment.