-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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,47 @@ | ||
import ReactModal from "react-modal"; | ||
import { useScreenClass } from "react-grid-system"; | ||
import { useNavigate } from "react-router-dom"; | ||
import SwapPage from "pages/Trade/Swap"; | ||
import IconButton from "components/IconButton"; | ||
import { MOBILE_SCREEN_CLASS } from "constants/layout"; | ||
import useSettingsModal from "hooks/modals/useSettingsModal"; | ||
import Modal from "components/Modal"; | ||
|
||
import iconSetting from "assets/icons/icon-setting.svg"; | ||
import iconSettingHover from "assets/icons/icon-setting-hover.svg"; | ||
|
||
function SwapModal(props: ReactModal.Props) { | ||
const navigate = useNavigate(); | ||
const screenClass = useScreenClass(); | ||
const settingsModal = useSettingsModal(); | ||
|
||
const { | ||
onRequestClose = () => { | ||
navigate("..", { replace: true, relative: "route" }); | ||
}, | ||
...modalProps | ||
} = props; | ||
|
||
return ( | ||
<Modal | ||
id="swap-modal" | ||
className="modal-parent" | ||
title="Swap" | ||
hasCloseButton | ||
drawer={screenClass === MOBILE_SCREEN_CLASS} | ||
onRequestClose={onRequestClose} | ||
headerExtra={ | ||
<IconButton | ||
size={38} | ||
icons={{ default: iconSetting, hover: iconSettingHover }} | ||
onClick={() => settingsModal.open()} | ||
/> | ||
} | ||
{...modalProps} | ||
> | ||
<SwapPage /> | ||
</Modal> | ||
); | ||
} | ||
|
||
export default SwapModal; |
This file contains 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 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 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 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