Skip to content

Commit a514ddf

Browse files
committed
add review dialog
1 parent 3da474a commit a514ddf

File tree

1 file changed

+17
-32
lines changed
  • src/components/swap/components/transaction-review

1 file changed

+17
-32
lines changed
Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import {
2-
Modal,
3-
ModalBody,
4-
ModalCloseButton,
5-
ModalContent,
6-
ModalHeader,
7-
ModalOverlay,
8-
} from '@chakra-ui/react'
9-
import clsx from 'clsx'
2+
Dialog,
3+
DialogBackdrop,
4+
DialogPanel,
5+
DialogTitle,
6+
} from '@headlessui/react'
107
import { useAtom } from 'jotai'
118

129
import { tradeMachineAtom } from '@/app/store/trade-machine'
13-
import { colors } from '@/lib/styles/colors'
10+
import { cn } from '@/lib/utils/tailwind'
1411

1512
import { Review } from './components/review'
1613
import { SubmissionResult } from './components/submission-result'
@@ -33,35 +30,23 @@ export const TransactionReviewModal = (props: TransactionReviewModalProps) => {
3330
const modalTitle = tradeState.matches('review') ? 'Review Transaction' : ''
3431

3532
return (
36-
<Modal
37-
onClose={onCloseModal}
38-
isOpen={tradeState.context.isModalOpen}
39-
isCentered
40-
>
41-
<ModalOverlay className='bg-ic-black bg-opacity-60 backdrop-blur' />
42-
<ModalContent
43-
borderRadius={24}
44-
backgroundColor={isDarkMode ? '#18181b' : '#FCFFFF'}
45-
className={clsx(
46-
'mx-4 my-0 border border-zinc-700',
33+
<Dialog onClose={onCloseModal} open={tradeState.context.isModalOpen}>
34+
<DialogBackdrop className='fixed inset-0 bg-black/30' />
35+
<DialogPanel
36+
className={cn(
37+
'bg-ic-white mx-4 my-0 rounded-3xl border border-zinc-700 dark:bg-[#18181b]',
4738
isDarkMode ? 'review' : '',
4839
)}
4940
>
5041
{modalTitle && (
51-
<ModalHeader className={clsx(isDarkMode ? 'dark' : '')}>
42+
<DialogTitle className={cn(isDarkMode ? 'dark' : '')}>
5243
<span className='text-ic-black dark:text-neutral-50'>
5344
{modalTitle}
5445
</span>
55-
</ModalHeader>
46+
</DialogTitle>
5647
)}
5748

58-
<ModalCloseButton
59-
color={isDarkMode ? colors.ic.white : colors.ic.black}
60-
/>
61-
<ModalBody
62-
className={clsx(isDarkMode ? 'dark' : '')}
63-
p='0 16px 16px 16px'
64-
>
49+
<div className={cn('px-4 pb-4', isDarkMode ? 'dark' : '')}>
6550
<SubmissionResult onClose={onCloseModal} />
6651

6752
{tradeState.context.transactionReview &&
@@ -71,8 +56,8 @@ export const TransactionReviewModal = (props: TransactionReviewModalProps) => {
7156
onSubmitWithSuccess={() => sendTradeEvent({ type: 'SUBMIT' })}
7257
/>
7358
)}
74-
</ModalBody>
75-
</ModalContent>
76-
</Modal>
59+
</div>
60+
</DialogPanel>
61+
</Dialog>
7762
)
7863
}

0 commit comments

Comments
 (0)