Skip to content

Commit f12d4a1

Browse files
authored
RI-7681: [NEW UI] Connection Settings (#5127)
* adjust some spacings and alignment around the dividers in the lower section * increase footer button sizes * replace the hard coded asterisk with required; add space between forms * replace the Arrow Left icon <- with Chevron icon < * add the info icon * attempt to fix the double scroll layout issue * remove unused divider class * fix margin for tls details * fix spacing around security items * adjust decompression and formatters tab spacing * adjust spacings and required fields in ssh and tls details * adjust spacings in the edit db connectivity settings * decrease spacer below private key / pass radio * adjust spacings and dividers to reduce space and not cause extra scrolls * use text for the label to make the format match the designs * decrease some spacings * remove the "should not exceed constraint" * wrap the checkbox in form field * add styles to modal content to spread through the whole content container * revert accidentally commited default formatter settings * fix tests * refactor the Divider component to be styled and replace all its occurences * move the flex:1 style to the modal body instead of compose * remove not needed important * change the info icon props interface import to come from LabelProps property instead from dist * make divider props optional * create host info tooltip content component * reaplce the new tooltip content in all occurences * get rid of unneeded classes * fix test Database Alias -> Database alias
1 parent 4c17b85 commit f12d4a1

File tree

34 files changed

+498
-573
lines changed

34 files changed

+498
-573
lines changed
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
import React, { ComponentProps } from 'react'
2-
import { FormField as RedisFormField, TooltipProvider } from '@redis-ui/components'
2+
import {
3+
FormField as RedisFormField,
4+
TooltipProvider,
5+
LabelProps,
6+
} from '@redis-ui/components'
7+
8+
export type RiInfoIconProps = LabelProps['infoIconProps']
39

410
export type RedisFormFieldProps = ComponentProps<typeof RedisFormField> & {
5-
infoIconProps?: any
11+
infoIconProps?: RiInfoIconProps
612
}
713

814
export function FormField(props: RedisFormFieldProps) {
915
// eslint-disable-next-line react/destructuring-assignment
1016
if (props.infoIconProps) {
11-
return <TooltipProvider>
12-
<RedisFormField {...props} />
13-
</TooltipProvider>
17+
return (
18+
<TooltipProvider>
19+
<RedisFormField {...props} />
20+
</TooltipProvider>
21+
)
1422
}
1523
return <RedisFormField {...props} />
1624
}

redisinsight/ui/src/components/divider/Divider.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react'
22
import { instance, mock } from 'ts-mockito'
33
import { render } from 'uiSrc/utils/test-utils'
4-
import Divider, { Props } from './Divider'
4+
import Divider, { DividerProps } from './Divider'
55

6-
const mockedProps = mock<Props>()
6+
const mockedProps = mock<DividerProps>()
77

88
describe('Divider', () => {
99
it('should render', () => {
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { HTMLAttributes } from 'react'
2+
import styled, { css } from 'styled-components'
3+
4+
export type DividerVariant = 'fullWidth' | 'half'
5+
export type DividerOrientation = 'horizontal' | 'vertical'
6+
7+
const dividerStyles = {
8+
orientation: {
9+
horizontal: css`
10+
width: 100%;
11+
height: 1px;
12+
`,
13+
vertical: css`
14+
width: 1px;
15+
height: 100%;
16+
`,
17+
},
18+
variant: {
19+
fullWidth: {
20+
horizontal: css``,
21+
vertical: css``,
22+
},
23+
half: {
24+
horizontal: css`
25+
width: 50%;
26+
`,
27+
vertical: css`
28+
height: 50%;
29+
`,
30+
},
31+
},
32+
}
33+
34+
export interface StyledDividerProps extends HTMLAttributes<HTMLHRElement> {
35+
$color?: string
36+
$orientation?: DividerOrientation
37+
$variant?: DividerVariant
38+
}
39+
40+
export const StyledDividerWrapper = styled.div<HTMLAttributes<HTMLDivElement>>`
41+
display: flex;
42+
align-items: center;
43+
justify-content: center;
44+
`
45+
46+
export const StyledDivider = styled.hr<StyledDividerProps>`
47+
border: none;
48+
background-color: ${({
49+
theme,
50+
$color = theme.semantic.color.background.neutral500,
51+
}) => $color};
52+
53+
${({ $orientation = 'horizontal' }) =>
54+
dividerStyles.orientation[$orientation]}
55+
${({ $variant = 'fullWidth', $orientation = 'horizontal' }) =>
56+
dividerStyles.variant[$variant][$orientation]}
57+
`
Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,33 @@
11
import React from 'react'
2-
import cx from 'classnames'
32

4-
import styles from './styles.module.scss'
3+
import {
4+
StyledDividerWrapper,
5+
StyledDivider,
6+
DividerVariant,
7+
DividerOrientation,
8+
} from './Divider.styles'
59

6-
export interface Props {
10+
export interface DividerProps {
11+
orientation?: DividerOrientation
12+
variant?: DividerVariant
713
color?: string
8-
colorVariable?: string
9-
orientation?: 'horizontal' | 'vertical'
10-
variant?: 'fullWidth' | 'middle' | 'half'
1114
className?: string
12-
style?: any
1315
}
1416

1517
const Divider = ({
1618
orientation,
1719
variant,
18-
className,
1920
color,
20-
colorVariable,
21+
className,
2122
...props
22-
}: Props) => (
23-
<div
24-
className={cx(
25-
styles.divider,
26-
styles[`divider-${variant || 'fullWidth'}`],
27-
styles[`divider-${orientation || 'horizontal'}`],
28-
className,
29-
)}
30-
{...props}
31-
>
32-
<hr
33-
style={
34-
color || colorVariable
35-
? { backgroundColor: color ?? `var(--${colorVariable})` }
36-
: {}
37-
}
23+
}: DividerProps) => (
24+
<StyledDividerWrapper {...props}>
25+
<StyledDivider
26+
$variant={variant}
27+
$orientation={orientation}
28+
$color={color}
3829
/>
39-
</div>
30+
</StyledDividerWrapper>
4031
)
4132

4233
export default Divider

redisinsight/ui/src/components/divider/styles.module.scss

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import styled from 'styled-components'
2+
import { Modal } from 'uiSrc/components/base/display/modal'
3+
4+
export const StyledFormDialogContent = styled(Modal.Content.Compose)`
5+
width: 900px;
6+
height: 700px;
7+
8+
max-width: calc(100vw - 120px);
9+
max-height: calc(100vh - 120px);
10+
`
11+
12+
export const StyledFormDialogContentBody = styled(Modal.Content.Body)`
13+
flex: 1;
14+
min-height: 0;
15+
`

redisinsight/ui/src/components/form-dialog/FormDialog.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React from 'react'
2-
import cx from 'classnames'
32

43
import { Nullable } from 'uiSrc/utils'
54
import { CancelIcon } from 'uiSrc/components/base/icons'
65
import { Modal } from 'uiSrc/components/base/display'
7-
import styles from './styles.module.scss'
6+
import {
7+
StyledFormDialogContent,
8+
StyledFormDialogContentBody,
9+
} from './FormDialog.styles'
810

911
export interface Props {
1012
isOpen: boolean
@@ -22,16 +24,16 @@ const FormDialog = (props: Props) => {
2224

2325
return (
2426
<Modal.Compose open={isOpen}>
25-
<Modal.Content.Compose
27+
<StyledFormDialogContent
2628
persistent
27-
className={cx(styles.modal, className)}
29+
className={className}
2830
onCancel={onClose}
2931
>
3032
<Modal.Content.Close icon={CancelIcon} onClick={onClose} />
3133
<Modal.Content.Header.Title>{header}</Modal.Content.Header.Title>
32-
<Modal.Content.Body content={children} />
34+
<StyledFormDialogContentBody content={children} />
3335
<Modal.Content.Footer.Compose>{footer}</Modal.Content.Footer.Compose>
34-
</Modal.Content.Compose>
36+
</StyledFormDialogContent>
3537
</Modal.Compose>
3638
)
3739
}

redisinsight/ui/src/components/form-dialog/styles.module.scss

Lines changed: 0 additions & 7 deletions
This file was deleted.

redisinsight/ui/src/components/notifications/components/infinite-messages/InfiniteMessages.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const INFINITE_MESSAGES: InfiniteMessagesType = {
124124
{!!details && (
125125
<>
126126
<Spacer size="m" />
127-
<Divider variant="fullWidth" />
127+
<Divider />
128128
<Spacer size="m" />
129129
<Row className={styles.detailsRow} justify="between">
130130
<FlexItem>

redisinsight/ui/src/pages/browser/components/bulk-actions/BulkActionsInfo/BulkActionsInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const BulkActionsInfo = (props: Props) => {
7575
)}
7676
</Row>
7777
</Col>
78-
<Divider colorVariable="separatorColor" />
78+
<Divider />
7979
{loading && (
8080
<BulkActionsProgressLine data-testid="progress-line">
8181
<div style={{ width: `${(total ? scanned / total : 0) * 100}%` }} />

0 commit comments

Comments
 (0)