Skip to content

Commit

Permalink
Merge pull request #25 from yauheni-kryzhyk-deriv/yauheni/76882/formc…
Browse files Browse the repository at this point in the history
…ancelbutton_ts_migration_

Yauheni/76882/formcancelbutton ts migration
  • Loading branch information
shayan-deriv committed Nov 17, 2022
2 parents 4c04f0f + b2a9244 commit dae1d67
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const AccountWizard: React.FC<TAccountWizard> = (props: TAccountWizard) => {
{wizard_steps}
</Wizard>
<DesktopWrapper>
<FormCancelButton label={localize('Cancel')} is_absolute onClick={onCancel} />
<FormCancelButton label={localize('Cancel')} is_absolute onCancel={onCancel} />
</DesktopWrapper>
</React.Fragment>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ButtonLoading from './button_loading';
import Icon from '../icon';
import Text from '../text';

type TButtonProps = React.PropsWithChildren<React.ButtonHTMLAttributes<HTMLButtonElement>> & {
export type TButtonProps = React.PropsWithChildren<React.ButtonHTMLAttributes<HTMLButtonElement>> & {
alternate: boolean;
blue: boolean;
classNameSpan: string;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import classNames from 'classnames';
import Button, { TButtonProps } from '../button/button';

type TFormCancelButton = Partial<TButtonProps> & {
className?: string;
is_absolute?: boolean;
is_center?: boolean;
is_disabled?: boolean;
label: string;
onCancel: () => void;
};

const FormCancelButton = ({
className,
is_center = false,
is_absolute = false,
label,
onCancel,
...props
}: TFormCancelButton) => {
return (
<div
className={classNames('dc-form-cancel-button', className, {
'dc-form-cancel-button--absolute': is_absolute,
'dc-form-cancel-button--center': is_center,
'dc-form-cancel-button--relative': !is_absolute,
})}
>
<Button has_effect onClick={onCancel} text={label} type='button' tertiary large {...props} />
</div>
);
};

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

export default FormCancelButton;

0 comments on commit dae1d67

Please sign in to comment.