Skip to content

Commit f4ae1d1

Browse files
committed
refactor(ui): port "Select CLoud Provider" modal styles from sass to styled components
re #RI-7415
1 parent 44e6f7f commit f4ae1d1

File tree

3 files changed

+52
-60
lines changed

3 files changed

+52
-60
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import styled from 'styled-components'
2+
import { ColorText, Text } from 'uiSrc/components/base/text'
3+
4+
export const StyledModalContentBody = styled.section`
5+
width: 575px !important;
6+
min-width: 575px !important;
7+
padding: 16px;
8+
text-align: center;
9+
`
10+
11+
export const StyledSubTitle = styled(Text)`
12+
padding: 0 40px;
13+
`
14+
15+
export const StyledRegion = styled.section`
16+
padding: 2px 45px;
17+
text-align: left;
18+
`
19+
20+
export const StyledRegionName = styled(ColorText)`
21+
padding-left: 4px;
22+
`
23+
24+
export const StyledRegionSelectDescription = styled(Text)`
25+
padding-top: 10px;
26+
`
27+
28+
export const StyledFooter = styled.footer`
29+
width: 100%;
30+
padding: 32px 46px 0 46px;
31+
`

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

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ import { CancelIcon } from 'uiSrc/components/base/icons'
3131
import { CloudSubscriptionPlanResponse } from 'apiSrc/modules/cloud/subscription/dto'
3232
import { OAuthProvider, OAuthProviders } from './constants'
3333
import styles from './styles.module.scss'
34+
import {
35+
StyledFooter,
36+
StyledModalContentBody,
37+
StyledRegion,
38+
StyledRegionName,
39+
StyledRegionSelectDescription,
40+
StyledSubTitle,
41+
} from './OAuthSelectPlan.styles'
3442

3543
export const DEFAULT_REGIONS = ['us-east-2', 'asia-northeast1']
3644
export const DEFAULT_PROVIDER = OAuthProvider.AWS
@@ -127,7 +135,7 @@ const OAuthSelectPlan = () => {
127135
data-test-subj={`oauth-region-${region}`}
128136
>
129137
{`${countryName} (${cityName})`}
130-
<ColorText className={styles.regionName}>{region}</ColorText>
138+
<StyledRegionName>{region}</StyledRegionName>
131139
{rsProviderRegions?.includes(region) && (
132140
<ColorText
133141
className={styles.rspreview}
@@ -174,10 +182,7 @@ const OAuthSelectPlan = () => {
174182

175183
return (
176184
<Modal.Compose open>
177-
<Modal.Content.Compose
178-
className={styles.container}
179-
data-testid="oauth-select-plan-dialog"
180-
>
185+
<Modal.Content.Compose data-testid="oauth-select-plan-dialog">
181186
<Modal.Content.Close
182187
icon={CancelIcon}
183188
onClick={handleOnClose}
@@ -189,12 +194,12 @@ const OAuthSelectPlan = () => {
189194
</Row>
190195
</Modal.Content.Header.Title>
191196
<Modal.Content.Body.Compose width="fit-content">
192-
<section className={styles.content}>
193-
<Text className={styles.subTitle} color="default">
197+
<StyledModalContentBody>
198+
<StyledSubTitle color="default">
194199
Select a cloud vendor and region to complete the final step
195200
towards your free Redis Cloud database. No credit card is
196201
required.
197-
</Text>
202+
</StyledSubTitle>
198203
<section className={styles.providers}>
199204
{OAuthProviders.map(({ icon, id, label }) => {
200205
const Icon = () => (
@@ -215,12 +220,12 @@ const OAuthSelectPlan = () => {
215220
[styles.activeProvider]: id === providerSelected,
216221
})}
217222
/>
218-
<Text className={styles.providerLabel}>{label}</Text>
223+
<Text>{label}</Text>
219224
</div>
220225
)
221226
})}
222227
</section>
223-
<section className={styles.region}>
228+
<StyledRegion>
224229
<Text className={styles.regionLabel}>Region</Text>
225230
<RiSelect
226231
loading={loading}
@@ -237,15 +242,15 @@ const OAuthSelectPlan = () => {
237242
}}
238243
/>
239244
{!regionOptions.length && (
240-
<Text
245+
<StyledRegionSelectDescription
241246
className={styles.selectDescription}
242247
data-testid="select-region-select-description"
243248
>
244249
No regions available, try another vendor.
245-
</Text>
250+
</StyledRegionSelectDescription>
246251
)}
247-
</section>
248-
<footer className={styles.footer}>
252+
</StyledRegion>
253+
<StyledFooter>
249254
<Row justify="end" gap="m">
250255
<SecondaryButton
251256
onClick={handleOnClose}
@@ -264,8 +269,8 @@ const OAuthSelectPlan = () => {
264269
Create database
265270
</PrimaryButton>
266271
</Row>
267-
</footer>
268-
</section>
272+
</StyledFooter>
273+
</StyledModalContentBody>
269274
</Modal.Content.Body.Compose>
270275
</Modal.Content.Compose>
271276
</Modal.Compose>
Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
.content {
2-
width: 575px !important;
3-
min-width: 575px !important;
4-
padding: 16px;
5-
text-align: center;
6-
}
7-
8-
.subTitle {
9-
padding: 0 40px;
10-
}
11-
121
.providers {
132
padding: 30px 45px 22px;
143
width: 100%;
@@ -37,14 +26,6 @@
3726
}
3827
}
3928

40-
.provider {
41-
position: relative;
42-
}
43-
44-
.providerLabel {
45-
font-size: 10px !important;
46-
}
47-
4829
.providerActiveIcon {
4930
position: absolute;
5031
top: -10px;
@@ -74,28 +55,3 @@
7455
.awsIcon svg > path:first-of-type {
7556
fill: var(--euiColorFullShade);
7657
}
77-
78-
.region {
79-
padding: 2px 45px;
80-
text-align: left;
81-
82-
.selectDescription {
83-
padding-top: 10px;
84-
}
85-
}
86-
87-
.regionSelectItem {
88-
background-color: var(--euiColorLightestShade) !important;
89-
&:hover {
90-
background-color: var(--hoverInListColorLight) !important;
91-
}
92-
}
93-
94-
.regionName {
95-
padding-left: 4px;
96-
}
97-
98-
.footer {
99-
width: 100%;
100-
padding: 32px 46px 0 46px;
101-
}

0 commit comments

Comments
 (0)