Skip to content

Commit

Permalink
Merge pull request #34 from likhith-deriv/likhith/76914/migrate-popov…
Browse files Browse the repository at this point in the history
…er-message-checkbox-component-to-tsx

likhith/migrated popover message checkbox component to tsx
  • Loading branch information
shayan-deriv committed Nov 22, 2022
2 parents 52af15f + d3092d1 commit 5c9c606
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
4 changes: 2 additions & 2 deletions packages/components/src/components/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import React from 'react';
import Icon from '../icon';
import Text from '../text';

type TCheckBoxProps = Omit<React.HTMLProps<HTMLInputElement>, 'value'> & {
type TCheckBoxProps = Omit<React.HTMLProps<HTMLInputElement>, 'value' | 'label'> & {
className?: string;
classNameLabel?: string;
defaultChecked?: boolean;
disabled?: boolean;
greyDisabled?: boolean;
id?: string;
label: string;
label: React.ReactElement;
onChange: (e: React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent<HTMLSpanElement>) => void;
value?: boolean;
withTabIndex?: number;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import PopoverMessageCheckbox from './popover-message-checkbox';

export default PopoverMessageCheckbox;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import Checkbox from '../checkbox';

type TPopoverMessageCheckbox = {
defaultChecked?: boolean;
message: string;
name?: string;
onChange: React.FormEventHandler<HTMLInputElement> &
((e: React.ChangeEvent<HTMLInputElement> | React.KeyboardEvent<HTMLSpanElement>) => void);
checkboxLabel: React.ReactElement;
};

const PopoverMessageCheckbox = ({
checkboxLabel,
defaultChecked,
onChange,
message,
name,
}: TPopoverMessageCheckbox) => (
<React.Fragment>
{message}
<Checkbox defaultChecked={defaultChecked} onChange={onChange} name={name} label={checkboxLabel} />
</React.Fragment>
);

export default PopoverMessageCheckbox;

0 comments on commit 5c9c606

Please sign in to comment.