This repository was archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
feat: inavlaid syntax issue #140
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f0d01d4
feat: inavlaid syntax issue
sanjam-deriv ed97a4b
feat: invalid syntax issue
sanjam-deriv 4fcb715
feat: invalid syntax issue
sanjam-deriv f3eb16f
Merge branch 'master' into invaliderror
sanjam-deriv bc3df20
chore: test case
sanjam-deriv ae0f130
fix: css fix
sanjam-deriv e2cc8c0
Merge branch 'master' into invaliderror
sanjam-deriv 5ae2e15
fix: cov fix
sanjam-deriv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
48 changes: 30 additions & 18 deletions
48
src/features/Apiexplorer/LoginDialog/LoginDialog.module.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
@use 'src/styles/utility' as *; | ||
|
||
.wrapper { | ||
width: rem(44); | ||
width: rem(44); | ||
} | ||
|
||
.modal { | ||
padding: rem(0.8) 0 0 rem(2.4); | ||
font-size: rem(1.4); | ||
line-height: rem(2); | ||
@media (max-width: 992px) { | ||
padding: 0 0 0 rem(1.6); | ||
} | ||
.modal { | ||
padding: rem(0.8) 0 0 rem(2.4); | ||
font-size: rem(1.4); | ||
line-height: rem(2); | ||
@media (max-width: 992px) { | ||
padding: 0 0 0 rem(1.6); | ||
} | ||
} | ||
.buttonWrapper { | ||
display: flex; | ||
justify-content: end; | ||
padding: rem(2.4); | ||
gap: rem(0.8); | ||
|
||
.btn { | ||
padding: rem(1) rem(1.6); | ||
} | ||
|
||
.buttonWrapper { | ||
display: flex; | ||
justify-content: end; | ||
padding: rem(2.4); | ||
gap: rem(0.8); | ||
|
||
.btn { | ||
padding: rem(1) rem(1.6); | ||
} | ||
} | ||
|
||
.validwrapper { | ||
width: rem(30); | ||
} | ||
.validmodal { | ||
padding: rem(0.8) rem(2.4) rem(2.4) rem(2.4); | ||
font-size: rem(1.4); | ||
line-height: rem(2); | ||
@media (max-width: 992px) { | ||
padding: rem(0.8) rem(1.6) rem(1.6) rem(1.6); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/features/Apiexplorer/ValidDialog/__tests__/ValidDialog.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import ValidDialog from '..'; | ||
import { screen, render } from '@testing-library/react'; | ||
|
||
describe('ValidDialog', () => { | ||
test('if correct test is rendered', () => { | ||
location.assign = jest.fn(); | ||
|
||
render(<ValidDialog setIsValid={jest.fn()} setToggleModal={jest.fn()} />); | ||
const text = screen.getByText( | ||
'Your JSON object is invalid. Please make sure you provide the correct syntax for your JSON object.', | ||
); | ||
|
||
expect(text).toBeVisible(); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { useCallback } from 'react'; | ||
import { Modal } from '@deriv/ui'; | ||
import styles from '../LoginDialog/LoginDialog.module.scss'; | ||
|
||
type TValidDialog = { | ||
setIsValid: React.Dispatch<React.SetStateAction<boolean>>; | ||
setToggleModal: React.Dispatch<React.SetStateAction<boolean>>; | ||
}; | ||
|
||
export const ValidDialog = ({ setIsValid, setToggleModal }: TValidDialog) => { | ||
const onOpenChange = useCallback( | ||
(open: boolean) => { | ||
if (!open) { | ||
setIsValid(false); | ||
setToggleModal(false); | ||
} | ||
}, | ||
[setIsValid, setToggleModal], | ||
); | ||
return ( | ||
<Modal defaultOpen onOpenChange={onOpenChange}> | ||
<Modal.Portal> | ||
<div className='modal-overlay'> | ||
<Modal.Overlay /> | ||
<Modal.PageContent | ||
title={'Invalid JSON'} | ||
has_close_button | ||
className={styles.validwrapper} | ||
> | ||
<div className={styles.validmodal}> | ||
Your JSON object is invalid. Please make sure you provide the correct syntax for your | ||
JSON object. | ||
</div> | ||
</Modal.PageContent> | ||
</div> | ||
</Modal.Portal> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ValidDialog; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.