1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-22 04:49:36 +02:00

UI Components

This commit is contained in:
unknown 2021-05-12 18:31:02 +02:00
parent fa5c35b619
commit f34bbd938d
10 changed files with 131 additions and 7 deletions

View file

@ -0,0 +1,35 @@
import { Fragment } from 'react';
import { Link } from 'react-router-dom';
import classes from './ActionButton.module.css';
import Icon from '../../Icon/Icon';
interface ComponentProps {
name: string;
icon: string;
link?: string;
handler?: () => void;
}
const ActionButton = (props: ComponentProps): JSX.Element => {
const body = (
<Fragment>
<div className={classes.ActionButtonIcon}>
<Icon icon={props.icon} />
</div>
<div className={classes.ActionButtonName}>
{props.name}
</div>
</Fragment>
);
if (props.link) {
return (<Link to={props.link}>{body}</Link>)
} else if (props.handler) {
return (<div className={classes.ActionButton} onClick={props.handler}>{body}</div>)
} else {
return (<div className={classes.ActionButton}>{body}</div>)
}
}
export default ActionButton;