update link button to accept button type color prop

This commit is contained in:
Abhinav 2022-05-02 18:25:00 +05:30
parent fec09c64b6
commit cc2a0ca875
2 changed files with 13 additions and 6 deletions

View file

@ -1,5 +1,6 @@
import { Link, LinkProps } from '@mui/material';
import React, { FC } from 'react';
import { ButtonProps } from 'react-bootstrap';
export enum ButtonVariant {
success = 'success',
@ -28,9 +29,15 @@ export function getVariantColor(variant: string) {
}
}
const LinkButton: FC<LinkProps<'button'>> = ({ children, ...props }) => {
const LinkButton: FC<LinkProps<'button', { color?: ButtonProps['color'] }>> = ({
children,
...props
}) => {
return (
<Link component="button" {...props}>
<Link
component="button"
{...props}
sx={{ color: props.color && `${props.color}.main` }}>
{children}
</Link>
);

View file

@ -318,7 +318,7 @@ function PlanSelector(props: Props) {
<>
{isSubscriptionCancelled(subscription) ? (
<LinkButton
variant="success"
color={'success'}
onClick={() =>
props.setDialogMessage({
title: constants.CONFIRM_ACTIVATE_SUBSCRIPTION,
@ -346,7 +346,7 @@ function PlanSelector(props: Props) {
</LinkButton>
) : (
<LinkButton
variant="danger"
color="danger"
onClick={() =>
props.setDialogMessage({
title: constants.CONFIRM_CANCEL_SUBSCRIPTION,
@ -372,7 +372,7 @@ function PlanSelector(props: Props) {
</LinkButton>
)}
<LinkButton
variant="primary"
color="primary"
onClick={updatePaymentMethod.bind(
null,
props.setDialogMessage,
@ -384,7 +384,7 @@ function PlanSelector(props: Props) {
</>
) : (
<LinkButton
variant="primary"
color="primary"
onClick={props.closeModal}
style={{
color: 'rgb(121, 121, 121)',