accounts-frontend/packages/app/components/ui/form/LinkButton.tsx

14 lines
436 B
TypeScript
Raw Normal View History

2019-12-07 16:58:52 +05:30
import React from 'react';
import { Link } from 'react-router-dom';
import Button from './Button';
type ButtonProps = React.ComponentProps<typeof Button>;
type LinkProps = React.ComponentProps<typeof Link>;
export default function LinkButton(props: ButtonProps & LinkProps) {
2020-05-24 04:38:24 +05:30
const { to, ...restProps } = props;
2019-12-07 16:58:52 +05:30
2020-05-24 04:38:24 +05:30
return <Button component={(linkProps) => <Link {...linkProps} to={to} />} {...(restProps as ButtonProps)} />;
2019-12-07 16:58:52 +05:30
}