add action prop to support buttons

This commit is contained in:
Samira Mokaram
2020-11-16 16:36:03 +01:00
parent 6fc060842e
commit e1c23fa4b3
2 changed files with 25 additions and 2 deletions
@@ -23,9 +23,10 @@ export type IconLinkVerticalProps = {
href?: string;
disabled?: boolean;
label: string;
action?: React.ReactNode;
};
const useIconStyles = makeStyles({
const useIconStyles = makeStyles(theme => ({
link: {
display: 'grid',
justifyItems: 'center',
@@ -41,12 +42,16 @@ const useIconStyles = makeStyles({
fontWeight: 600,
letterSpacing: 1.2,
},
});
linkStyle: {
color: theme.palette.secondary.main,
},
}));
export function IconLinkVertical({
icon = <LinkIcon />,
href = '#',
disabled = false,
action,
...props
}: IconLinkVerticalProps) {
const classes = useIconStyles();
@@ -64,6 +69,23 @@ export function IconLinkVertical({
);
}
if (action) {
return (
<Link
className={
disabled
? classnames(classes.link, classes.linkStyle, classes.disabled)
: classnames(classes.link, classes.linkStyle)
}
href={href}
{...props}
>
{icon}
{action}
</Link>
);
}
return (
<Link className={classes.link} href={href} {...props}>
{icon}
+1
View File
@@ -23,3 +23,4 @@ export { Router } from './components/Router';
export { useEntity, EntityContext } from './hooks/useEntity';
export { AboutCard } from './components/AboutCard';
export { EntityPageLayout } from './components/EntityPageLayout';
export { IconLinkVertical } from './components/AboutCard/IconLinkVertical';