@@ -2,6 +2,7 @@ import classNames from 'classnames'
22
33import Button from 'components/common/Button'
44import Checkbox from 'components/common/Checkbox'
5+ import EscButton from 'components/common/Button/EscButton'
56import Text from 'components/common/Text'
67import { NoIcon , YesIcon } from 'components/Modals/AlertDialog/ButtonIcons'
78import Modal from 'components/Modals/Modal'
@@ -22,7 +23,17 @@ interface Props {
2223}
2324
2425function AlertDialog ( props : Props ) {
25- const { title, icon, content, negativeButton, positiveButton, checkbox, header } = props . config
26+ const {
27+ title,
28+ icon,
29+ content,
30+ negativeButton,
31+ positiveButton,
32+ checkbox,
33+ header,
34+ isSingleButtonLayout,
35+ showCloseButton,
36+ } = props . config
2637
2738 const [ toggle , handleToggle ] = useToggle ( )
2839
@@ -42,7 +53,10 @@ function AlertDialog(props: Props) {
4253 hideTxLoader
4354 header = {
4455 header ? (
45- header
56+ < div className = 'flex items-center justify-between w-full' >
57+ { header }
58+ { showCloseButton && < EscButton onClick = { props . close } /> }
59+ </ div >
4660 ) : (
4761 < div className = 'flex flex-col' >
4862 { icon && (
@@ -65,42 +79,67 @@ function AlertDialog(props: Props) {
6579 ) : (
6680 content
6781 ) }
68- < div
69- className = { classNames (
70- 'mt-10 flex justify-between gap-4 md:flex-nowrap flex-wrap' ,
71- positiveButton && 'flex-row-reverse' ,
72- ) }
73- >
74- < div className = 'flex flex-row-reverse gap-4' >
82+ { isSingleButtonLayout ? (
83+ < div className = 'mt-10 flex flex-col gap-4' >
84+ { checkbox && (
85+ < div className = 'flex justify-center' >
86+ < Checkbox
87+ name = 'hls-info-toggle'
88+ checked = { toggle }
89+ onChange = { handleCheckboxClick }
90+ text = { checkbox . text }
91+ />
92+ </ div >
93+ ) }
7594 { positiveButton && (
7695 < Button
77- text = { positiveButton . text ?? 'Yes' }
78- color = 'tertiary'
79- className = 'px-6'
80- rightIcon = { positiveButton . icon ?? < YesIcon /> }
81- iconClassName = 'h-4 w-5'
96+ text = { positiveButton . text ?? 'Continue' }
97+ color = 'primary'
98+ className = 'w-full'
99+ rightIcon = { positiveButton . icon }
82100 onClick = { ( ) => handleButtonClick ( positiveButton ) }
83101 disabled = { positiveButton . disabled }
84102 />
85103 ) }
86- { checkbox && (
87- < Checkbox
88- name = 'hls-info-toggle'
89- checked = { toggle }
90- onChange = { handleCheckboxClick }
91- text = { checkbox . text }
92- />
104+ </ div >
105+ ) : (
106+ < div
107+ className = { classNames (
108+ 'mt-10 flex justify-between gap-4 md:flex-nowrap flex-wrap' ,
109+ positiveButton && 'flex-row-reverse' ,
93110 ) }
111+ >
112+ < div className = 'flex flex-row-reverse gap-4' >
113+ { positiveButton && (
114+ < Button
115+ text = { positiveButton . text ?? 'Yes' }
116+ color = 'tertiary'
117+ className = 'px-6'
118+ rightIcon = { positiveButton . icon ?? < YesIcon /> }
119+ iconClassName = 'h-4 w-5'
120+ onClick = { ( ) => handleButtonClick ( positiveButton ) }
121+ disabled = { positiveButton . disabled }
122+ />
123+ ) }
124+ { checkbox && (
125+ < Checkbox
126+ name = 'hls-info-toggle'
127+ checked = { toggle }
128+ onChange = { handleCheckboxClick }
129+ text = { checkbox . text }
130+ />
131+ ) }
132+ </ div >
133+ < Button
134+ text = { negativeButton ?. text ?? 'No' }
135+ color = 'secondary'
136+ className = 'px-6'
137+ rightIcon = { negativeButton ?. icon ?? < NoIcon /> }
138+ tabIndex = { 1 }
139+ onClick = { ( ) => handleButtonClick ( negativeButton ) }
140+ />
94141 </ div >
95- < Button
96- text = { negativeButton ?. text ?? 'No' }
97- color = 'secondary'
98- className = 'px-6'
99- rightIcon = { negativeButton ?. icon ?? < NoIcon /> }
100- tabIndex = { 1 }
101- onClick = { ( ) => handleButtonClick ( negativeButton ) }
102- />
103- </ div >
142+ ) }
104143 </ Modal >
105144 )
106145}
0 commit comments