Skip to content

Commit 455af3b

Browse files
committed
replace select plan modal
1 parent 17b9cb2 commit 455af3b

File tree

1 file changed

+86
-85
lines changed

1 file changed

+86
-85
lines changed

redisinsight/ui/src/components/oauth/oauth-select-plan/OAuthSelectPlan.tsx

Lines changed: 86 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useCallback, useEffect, useState } from 'react'
2-
import { EuiModal, EuiModalBody } from '@elastic/eui'
32
import { toNumber, filter, get, find, first } from 'lodash'
43
import { useDispatch, useSelector } from 'react-redux'
54
import cx from 'classnames'
@@ -23,10 +22,10 @@ import {
2322
PrimaryButton,
2423
SecondaryButton,
2524
} from 'uiSrc/components/base/forms/buttons'
26-
import { Title } from 'uiSrc/components/base/text/Title'
2725
import { ColorText, Text } from 'uiSrc/components/base/text'
2826
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
2927
import { RiSelect } from 'uiSrc/components/base/forms/select/RiSelect'
28+
import { Modal } from 'uiSrc/components/base/display'
3029
import { CloudSubscriptionPlanResponse } from 'apiSrc/modules/cloud/subscription/dto'
3130
import { OAuthProvider, OAuthProviders } from './constants'
3231
import styles from './styles.module.scss'
@@ -172,93 +171,95 @@ const OAuthSelectPlan = () => {
172171
}
173172

174173
return (
175-
<EuiModal
174+
<Modal
175+
open
176+
width="fit-content"
176177
className={styles.container}
177-
onClose={handleOnClose}
178+
onCancel={handleOnClose}
178179
data-testid="oauth-select-plan-dialog"
179-
>
180-
<EuiModalBody className={styles.modalBody}>
181-
<section className={styles.content}>
182-
<Title size="XL" className={styles.title}>
183-
Choose a cloud vendor
184-
</Title>
185-
<Text className={styles.subTitle}>
186-
Select a cloud vendor and region to complete the final step towards
187-
your free trial Redis database. No credit card is required.
188-
</Text>
189-
<section className={styles.providers}>
190-
{OAuthProviders.map(({ icon, id, label }) => {
191-
const Icon = () => (
192-
<RiIcon type={icon} size="original" style={{ width: 44 }} />
193-
)
194-
return (
195-
<div className={styles.provider} key={id}>
196-
{id === providerSelected && (
197-
<div className={cx(styles.providerActiveIcon)}>
198-
<RiIcon type="CheckThinIcon" />
199-
</div>
200-
)}
201-
<EmptyButton
202-
size="large"
203-
icon={Icon}
204-
onClick={() => setProviderSelected(id)}
205-
className={cx(styles.providerBtn, {
206-
[styles.activeProvider]: id === providerSelected,
207-
})}
208-
/>
209-
<Text className={styles.providerLabel}>{label}</Text>
210-
</div>
211-
)
212-
})}
213-
</section>
214-
<section className={styles.region}>
215-
<Text className={styles.regionLabel}>Region</Text>
216-
<RiSelect
217-
loading={loading}
218-
disabled={loading || !regionOptions.length}
219-
options={regionOptions}
220-
value={planIdSelected}
221-
data-testid="select-oauth-region"
222-
onChange={onChangeRegion}
223-
valueRender={({ option, isOptionValue }) => {
224-
if (isOptionValue) {
225-
return option.inputDisplay
226-
}
227-
return option.dropdownDisplay
228-
}}
229-
/>
230-
{!regionOptions.length && (
231-
<Text
232-
className={styles.selectDescription}
233-
data-testid="select-region-select-description"
180+
title="Choose a cloud vendor"
181+
content={
182+
<>
183+
<section className={styles.content}>
184+
<Text className={styles.subTitle}>
185+
Select a cloud vendor and region to complete the final step
186+
towards your free trial Redis database. No credit card is
187+
required.
188+
</Text>
189+
<section className={styles.providers}>
190+
{OAuthProviders.map(({ icon, id, label }) => {
191+
const Icon = () => (
192+
<RiIcon type={icon} size="original" style={{ width: 44 }} />
193+
)
194+
return (
195+
<div className={styles.provider} key={id}>
196+
{id === providerSelected && (
197+
<div className={cx(styles.providerActiveIcon)}>
198+
<RiIcon type="CheckThinIcon" />
199+
</div>
200+
)}
201+
<EmptyButton
202+
size="large"
203+
icon={Icon}
204+
onClick={() => setProviderSelected(id)}
205+
className={cx(styles.providerBtn, {
206+
[styles.activeProvider]: id === providerSelected,
207+
})}
208+
/>
209+
<Text className={styles.providerLabel}>{label}</Text>
210+
</div>
211+
)
212+
})}
213+
</section>
214+
<section className={styles.region}>
215+
<Text className={styles.regionLabel}>Region</Text>
216+
<RiSelect
217+
loading={loading}
218+
disabled={loading || !regionOptions.length}
219+
options={regionOptions}
220+
value={planIdSelected}
221+
data-testid="select-oauth-region"
222+
onChange={onChangeRegion}
223+
valueRender={({ option, isOptionValue }) => {
224+
if (isOptionValue) {
225+
return option.inputDisplay
226+
}
227+
return option.dropdownDisplay
228+
}}
229+
/>
230+
{!regionOptions.length && (
231+
<Text
232+
className={styles.selectDescription}
233+
data-testid="select-region-select-description"
234+
>
235+
No regions available, try another vendor.
236+
</Text>
237+
)}
238+
</section>
239+
<footer className={styles.footer}>
240+
<SecondaryButton
241+
className={styles.button}
242+
onClick={handleOnClose}
243+
data-testid="close-oauth-select-plan-dialog"
244+
aria-labelledby="close oauth select plan dialog"
245+
>
246+
Cancel
247+
</SecondaryButton>
248+
<PrimaryButton
249+
disabled={loading || !planIdSelected}
250+
loading={loading}
251+
className={styles.button}
252+
onClick={handleSubmit}
253+
data-testid="submit-oauth-select-plan-dialog"
254+
aria-labelledby="submit oauth select plan dialog"
234255
>
235-
No regions available, try another vendor.
236-
</Text>
237-
)}
256+
Create database
257+
</PrimaryButton>
258+
</footer>
238259
</section>
239-
<footer className={styles.footer}>
240-
<SecondaryButton
241-
className={styles.button}
242-
onClick={handleOnClose}
243-
data-testid="close-oauth-select-plan-dialog"
244-
aria-labelledby="close oauth select plan dialog"
245-
>
246-
Cancel
247-
</SecondaryButton>
248-
<PrimaryButton
249-
disabled={loading || !planIdSelected}
250-
loading={loading}
251-
className={styles.button}
252-
onClick={handleSubmit}
253-
data-testid="submit-oauth-select-plan-dialog"
254-
aria-labelledby="submit oauth select plan dialog"
255-
>
256-
Create database
257-
</PrimaryButton>
258-
</footer>
259-
</section>
260-
</EuiModalBody>
261-
</EuiModal>
260+
</>
261+
}
262+
/>
262263
)
263264
}
264265

0 commit comments

Comments
 (0)