Skip to content

Commit

Permalink
EPMRPP-91757 || modal and toggle fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadim73i committed Jul 29, 2024
1 parent cca6ff5 commit a33f706
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/modal/modal.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ const meta: Meta<typeof Modal> = {
children: 'Some modal content',
okButton: {
type: 'submit',
children: 'Login',
text: 'Login',
onClick: () => {
console.log('Logged in successfully');
},
},
cancelButton: {
children: 'Cancel',
text: 'Cancel',
},
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ interface ModalProps {
size?: ModalSize;
overlay?: ModalOverlay;
allowCloseOutside?: boolean;
okButton?: ButtonProps;
cancelButton?: ButtonProps;
okButton?: ButtonProps & { text: string };
cancelButton?: ButtonProps & { text: string };
scrollable?: boolean;
withoutFooter?: boolean;
CustomFooter?: FC<{ closeHandler: () => void }>;
Expand Down
12 changes: 8 additions & 4 deletions src/components/modal/modalFooter/modalFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export type ModalSize = 'default' | 'small' | 'large';
interface ModalFooterProps {
closeHandler: MouseEventHandler<HTMLButtonElement>;
footerNode?: ReactNode;
okButton?: ButtonProps;
cancelButton?: ButtonProps;
okButton?: ButtonProps & { text: string };
cancelButton?: ButtonProps & { text: string };
size?: ModalSize;
}

Expand All @@ -33,12 +33,16 @@ export const ModalFooter: FC<ModalFooterProps> = ({
adjustWidthOn={size === 'small' ? 'parent' : 'content'}
onClick={closeHandler}
{...cancelButton}
/>
>
{cancelButton.text}
</Button>
</div>
)}
{okButton && (
<div className={cx('button-container')}>
<Button adjustWidthOn={size === 'small' ? 'parent' : 'content'} {...okButton} />
<Button adjustWidthOn={size === 'small' ? 'parent' : 'content'} {...okButton}>
{okButton.text}
</Button>
</div>
)}
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/toggle/toggle.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@include font-scale();
color: var(--rp-ui-base-almost-black);
cursor: pointer;
width: 32px;
}

.children-container {
Expand Down

0 comments on commit a33f706

Please sign in to comment.