Skip to content

Commit 7776f86

Browse files
Merge pull request #4292 from RedisInsight/fe/feature/RI-6554
#RI-6554 - update icons and connectivity buttons
2 parents 113988e + bec49d5 commit 7776f86

File tree

7 files changed

+110
-49
lines changed

7 files changed

+110
-49
lines changed
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

redisinsight/ui/src/pages/home/components/add-database-screen/AddDatabaseScreen.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
import { Pages } from 'uiSrc/constants'
2424
import ConnectivityOptions from './components/connectivity-options'
2525
import ConnectionUrl from './components/connection-url'
26+
import { Values } from './constants'
2627

2728
import styles from './styles.module.scss'
2829

@@ -63,9 +64,9 @@ const AddDatabaseScreen = (props: Props) => {
6364
const dispatch = useDispatch()
6465
const history = useHistory()
6566

66-
const validate = (values: any) => {
67+
const validate = (values: Values) => {
6768
const payload = getPayload(values.connectionURL, true)
68-
setIsInvalid(!payload && values.connectionURL)
69+
setIsInvalid(!payload && !!values.connectionURL)
6970
}
7071

7172
const handleTestConnection = () => {
@@ -87,7 +88,7 @@ const AddDatabaseScreen = (props: Props) => {
8788
}))
8889
}
8990

90-
const formik = useFormik({
91+
const formik = useFormik<Values>({
9192
initialValues: {
9293
connectionURL: 'redis://[email protected]:6379'
9394
},

redisinsight/ui/src/pages/home/components/add-database-screen/components/connectivity-options/ConnectivityOptions.tsx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { EuiButton, EuiFlexGrid, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'
2+
import { EuiBadge, EuiButton, EuiFlexGrid, EuiFlexItem, EuiSpacer, EuiTitle } from '@elastic/eui'
33
import cx from 'classnames'
44
import { AddDbType } from 'uiSrc/pages/home/constants'
55
import { OAuthSsoHandlerDialog } from 'uiSrc/components'
@@ -8,7 +8,7 @@ import { EXTERNAL_LINKS, UTM_CAMPAINGS } from 'uiSrc/constants/links'
88
import { OAuthSocialAction, OAuthSocialSource } from 'uiSrc/slices/interfaces'
99

1010
import CloudIcon from 'uiSrc/assets/img/oauth/cloud_centered.svg?react'
11-
import StarIcon from 'uiSrc/assets/img/icons/star.svg?react'
11+
import RocketIcon from 'uiSrc/assets/img/oauth/rocket.svg?react'
1212

1313
import { CONNECTIVITY_OPTIONS } from '../../constants'
1414

@@ -24,30 +24,31 @@ const ConnectivityOptions = (props: Props) => {
2424

2525
return (
2626
<>
27-
<section>
27+
<section className={styles.cloudSection}>
2828
<EuiTitle size="xs" className={styles.sectionTitle}>
2929
<span>
30-
<CloudIcon className={styles.cloudIcon} />Get started with Redis Cloud account
30+
Get started with Redis Cloud account
3131
</span>
3232
</EuiTitle>
3333
<EuiSpacer />
34-
<EuiFlexGrid columns={3}>
35-
<EuiFlexItem grow={1}>
34+
<EuiFlexGrid>
35+
<EuiFlexItem grow={false}>
3636
<EuiButton
3737
color="secondary"
3838
className={styles.typeBtn}
3939
onClick={() => onClickOption(AddDbType.cloud)}
4040
data-testid="discover-cloud-btn"
4141
>
42-
Add Cloud databases
42+
<CloudIcon className={styles.btnIcon} />
43+
Add databases
4344
</EuiButton>
4445
</EuiFlexItem>
45-
<EuiFlexItem grow={1}>
46+
<EuiFlexItem grow={false}>
4647
<OAuthSsoHandlerDialog>
4748
{(ssoCloudHandlerClick, isSSOEnabled) => (
4849
<EuiButton
4950
color="secondary"
50-
className={cx(styles.typeBtn, styles.primary)}
51+
className={styles.typeBtn}
5152
href={getUtmExternalLink(EXTERNAL_LINKS.tryFree, {
5253
campaign: UTM_CAMPAINGS[OAuthSocialSource.AddDbForm]
5354
})}
@@ -61,8 +62,9 @@ const ConnectivityOptions = (props: Props) => {
6162
}}
6263
data-testid="create-free-db-btn"
6364
>
64-
<StarIcon className={styles.star} />
65-
Create free database
65+
<EuiBadge color="subdued" className={styles.freeBadge}>Free</EuiBadge>
66+
<RocketIcon className={cx(styles.btnIcon, styles.rocket)} />
67+
New database
6668
</EuiButton>
6769
)}
6870
</OAuthSsoHandlerDialog>
@@ -76,15 +78,16 @@ const ConnectivityOptions = (props: Props) => {
7678
<span>More connectivity options</span>
7779
</EuiTitle>
7880
<EuiSpacer />
79-
<EuiFlexGrid columns={3}>
80-
{CONNECTIVITY_OPTIONS.map(({ id, type, title }) => (
81-
<EuiFlexItem grow={1} key={id}>
81+
<EuiFlexGrid>
82+
{CONNECTIVITY_OPTIONS.map(({ id, type, title, icon }) => (
83+
<EuiFlexItem grow={false} key={id}>
8284
<EuiButton
8385
color="secondary"
84-
className={styles.typeBtn}
86+
className={cx(styles.typeBtn, styles.small)}
8587
onClick={() => onClickOption(type)}
8688
data-testid={`option-btn-${id}`}
8789
>
90+
{icon?.({ className: styles.btnIcon })}
8891
{title}
8992
</EuiButton>
9093
</EuiFlexItem>

redisinsight/ui/src/pages/home/components/add-database-screen/components/connectivity-options/styles.module.scss

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,72 @@
22
font-weight: 400 !important;
33
display: flex;
44
align-items: center;
5+
}
56

6-
.cloudIcon {
7-
margin-right: 8px;
7+
.cloudSection {
8+
.typeBtn {
9+
min-width: 160px !important;
810
}
911
}
1012

1113
.typeBtn {
14+
position: relative;
1215
width: 100%;
13-
height: 76px !important;
16+
height: 84px !important;
17+
padding: 0 12px;
1418

1519
border-color: var(--separatorColorLight) !important;
1620
color: var(--buttonSecondaryTextColor) !important;
1721
box-shadow: none !important;
1822

19-
&.primary {
20-
border-color: var(--euiColorSecondary) !important;
23+
&.small {
24+
padding: 0 8px;
25+
height: 52px !important;
26+
27+
:global(.euiButton__text) {
28+
flex-direction: row;
29+
}
30+
31+
.btnIcon {
32+
margin-right: 8px;
33+
}
2134
}
2235

2336
&:hover {
2437
background-color: transparent !important;
2538
}
26-
}
2739

28-
.star {
29-
margin-right: 4px;
40+
:global(.euiButton__text) {
41+
display: flex;
42+
flex-direction: column;
43+
align-items: center;
44+
font-weight: 400 !important;
45+
}
46+
47+
&:not(.small) {
48+
.btnIcon {
49+
margin-bottom: 8px;
50+
51+
&.rocket {
52+
fill: currentColor;
53+
height: 24px;
54+
width: 24px;
55+
}
56+
}
57+
}
58+
59+
60+
61+
.freeBadge {
62+
position: absolute;
63+
top: 0;
64+
left: 50%;
65+
transform: translate(-50%, -50%);
66+
z-index: 1;
67+
68+
text-transform: uppercase;
69+
background-color: var(--euiColorLightestShade);
70+
border: 1px solid var(--euiColorPrimary);
71+
border-radius: 2px !important;
72+
}
3073
}

redisinsight/ui/src/pages/home/components/add-database-screen/constants.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from 'react'
2+
import { EuiIcon } from '@elastic/eui'
3+
import { AddDbType } from 'uiSrc/pages/home/constants'
4+
5+
import ShieldIcon from 'uiSrc/assets/img/shield.svg?react'
6+
import RedisSoftwareIcon from 'uiSrc/assets/img/redis-software.svg?react'
7+
8+
export interface Values {
9+
connectionURL: string
10+
}
11+
12+
export const CONNECTIVITY_OPTIONS = [
13+
{
14+
id: 'sentinel',
15+
title: 'Redis Sentinel',
16+
type: AddDbType.sentinel,
17+
icon: (props: Record<string, any> = {}) => <ShieldIcon {...props} />
18+
},
19+
{
20+
id: 'software',
21+
title: 'Redis Software',
22+
type: AddDbType.software,
23+
icon: (props: Record<string, any> = {}) => <RedisSoftwareIcon {...props} />
24+
},
25+
{
26+
id: 'import',
27+
title: 'Import from file',
28+
type: AddDbType.import,
29+
icon: (props: Record<string, any> = {}) => <EuiIcon type="importAction" {...props} />
30+
}
31+
]

0 commit comments

Comments
 (0)