2019-10-08 12:47:11 +07:00
|
|
|
import React from 'react';
|
|
|
|
import Info from '@material-ui/icons/Info';
|
|
|
|
import Help from '@material-ui/icons/Help';
|
|
|
|
import Search from '@material-ui/icons/Search';
|
|
|
|
|
2019-10-12 13:45:39 +07:00
|
|
|
import IconButton from '../../muiComponents/IconButton';
|
|
|
|
|
2019-10-08 12:47:11 +07:00
|
|
|
import { IconSearchButton, StyledExternalLink } from './styles';
|
|
|
|
|
|
|
|
export type TooltipIconType = 'search' | 'help' | 'info';
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
tooltipIconType: TooltipIconType;
|
|
|
|
onClick?: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
const HeaderToolTipIcon: React.FC<Props> = ({ tooltipIconType, onClick }) => {
|
|
|
|
switch (tooltipIconType) {
|
|
|
|
case 'help':
|
|
|
|
return (
|
2019-10-27 21:49:30 +07:00
|
|
|
<StyledExternalLink
|
|
|
|
blank={true}
|
|
|
|
data-testid={'header--tooltip-documentation'}
|
|
|
|
to={'https://verdaccio.org/docs/en/installation'}>
|
2019-10-08 12:47:11 +07:00
|
|
|
<IconButton color={'inherit'}>
|
|
|
|
<Help />
|
|
|
|
</IconButton>
|
|
|
|
</StyledExternalLink>
|
|
|
|
);
|
|
|
|
case 'info':
|
|
|
|
return (
|
2019-10-27 21:49:30 +07:00
|
|
|
<IconButton
|
|
|
|
color="inherit"
|
|
|
|
data-testid={'header--tooltip-info'}
|
|
|
|
id="header--button-registryInfo"
|
|
|
|
onClick={onClick}>
|
2019-10-08 12:47:11 +07:00
|
|
|
<Info />
|
|
|
|
</IconButton>
|
|
|
|
);
|
|
|
|
case 'search':
|
|
|
|
return (
|
|
|
|
<IconSearchButton color="inherit" onClick={onClick}>
|
|
|
|
<Search />
|
|
|
|
</IconSearchButton>
|
|
|
|
);
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default HeaderToolTipIcon;
|