Skip to content

Commit

Permalink
Merge pull request #36 from yauheni-kryzhyk-deriv/yauheni/76884/forms…
Browse files Browse the repository at this point in the history
…ubmitbutton_ts_migration

yauheni/76884/formsubmitbutton ts migration
  • Loading branch information
suisin-deriv committed Nov 4, 2022
2 parents 59029a8 + 1e7b110 commit 7a9a408
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
import classNames from 'classnames';
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import Button from '../button/button';
import Text from '../text';

type FormSubmitButton = React.ButtonHTMLAttributes<HTMLButtonElement> & {
className: string;
has_cancel: boolean;
is_absolute: boolean;
is_center: boolean;
is_disabled: boolean;
label: string;
cancel_label: string;
form_error: string;
cancel_icon: React.ReactElement;
is_loading: boolean;
onCancel: () => void;
};

const FormSubmitButton = ({
cancel_label,
className,
has_cancel,
form_error,
has_cancel = false,
form_error = '',
cancel_icon,
is_center,
is_disabled,
is_absolute,
is_center = false,
is_disabled = false,
is_absolute = false,
is_loading,
label,
onCancel,
...props
}) => {
}: Partial<FormSubmitButton>) => {
return (
<div
className={classNames('dc-form-submit-button', className, {
Expand Down Expand Up @@ -61,27 +74,4 @@ const FormSubmitButton = ({
);
};

FormSubmitButton.defaultProps = {
className: undefined,
has_cancel: false,
form_error: '',
is_disabled: false,
is_center: false,
is_absolute: false,
};

FormSubmitButton.propTypes = {
className: PropTypes.string,
has_cancel: PropTypes.bool,
is_absolute: PropTypes.bool,
is_center: PropTypes.bool,
is_disabled: PropTypes.bool,
label: PropTypes.string,
cancel_label: PropTypes.string,
form_error: PropTypes.string,
cancel_icon: PropTypes.node,
is_loading: PropTypes.bool,
onCancel: PropTypes.func,
};

export default FormSubmitButton;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import FormSubmitButton from './form-submit-button.jsx';
import FormSubmitButton from './form-submit-button';
import './form-submit-button.scss';

export default FormSubmitButton;

0 comments on commit 7a9a408

Please sign in to comment.