Skip to content

Commit 2fb76d1

Browse files
committed
small fixes to SentinelDatabases.tsx
1 parent 62f6c07 commit 2fb76d1

File tree

6 files changed

+57
-52
lines changed

6 files changed

+57
-52
lines changed

.storybook/preview.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { CommonStyles, themeDark, themeLight, themeOld } from '@redis-ui/styles'
99
import 'modern-normalize/modern-normalize.css'
1010
import '@redis-ui/styles/normalized-styles.css'
1111
import '@redis-ui/styles/fonts.css'
12+
import 'uiSrc/pages/home/styles.scss'
1213
import { RootStoryLayout } from './RootStoryLayout'
1314
import { StoryContextProvider } from './Story.context'
1415
import { useStoryContext } from 'storybook/internal/preview-api'
@@ -18,12 +19,13 @@ import { type Theme } from 'uiSrc/components/base/theme/types'
1819
import { Provider } from 'react-redux'
1920
import { store } from 'uiSrc/slices/store'
2021
import Router from 'uiSrc/Router'
22+
import { StyledContainer } from './helpers/styles'
2123

2224
const parameters: Parameters = {
2325
parameters: {
2426
layout: 'centered',
2527
},
26-
actions: { argTypesRegex: '^on[A-Z].*' },
28+
actions: { argTypesRegex: '^on.*' },
2729
controls: {
2830
disableSaveFromUI: true,
2931
matchers: {
@@ -51,7 +53,7 @@ const parameters: Parameters = {
5153
const GlobalStoryStyles = createGlobalStyle`
5254
.sb-show-main, .docs-story {
5355
background: ${({ theme }: { theme: Theme }) => theme.globals.body.bgColor};
54-
color: ${({ theme }: { theme: Theme }) => theme.globals.body.textColor};
56+
color: ${({ theme }: { theme: Theme }) => theme.components.typography.colors.primary};
5557
}
5658
`
5759

@@ -65,7 +67,9 @@ const preview: Preview = {
6567
<TooltipProvider>
6668
<RootStoryLayout storyContext={useStoryContext()}>
6769
<CommonStyles />
68-
<Story />
70+
<StyledContainer>
71+
<Story />
72+
</StyledContainer>
6973
</RootStoryLayout>
7074
</TooltipProvider>
7175
</Provider>

redisinsight/ui/src/components/auto-discover/index.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import React from 'react'
12
import styled from 'styled-components'
23
import { Checkbox } from 'uiSrc/components/base/forms/checkbox/Checkbox'
34
import { Text, Title } from 'uiSrc/components/base/text'
@@ -6,10 +7,9 @@ import { Col, FlexItem } from 'uiSrc/components/base/layout/flex'
67
import { FormField } from 'uiSrc/components/base/forms/FormField'
78
import { IconButton } from 'uiSrc/components/base/forms/buttons'
89
import { CopyIcon } from 'uiSrc/components/base/icons'
9-
import { PaddingType } from 'uiSrc/components/base/layout/flex/flex.styles'
1010

1111
export const PageTitle = styled(Title).attrs({
12-
size: 'M',
12+
size: 'L',
1313
})`
1414
padding-bottom: ${({ theme }: { theme: Theme }) => theme.core.space.space050};
1515
`
@@ -28,7 +28,7 @@ export const SearchForm = styled(FormField)`
2828
`
2929
export const Footer = styled(FlexItem).attrs<{
3030
grow?: boolean | number
31-
padding?: PaddingType
31+
padding?: React.ComponentProps<typeof FlexItem>['padding']
3232
}>(({ grow, padding }) => ({
3333
grow: grow ?? false,
3434
padding: padding ?? 6,
@@ -56,30 +56,31 @@ export const DatabaseWrapper = styled.div`
5656
theme.semantic.color.background.neutral100};
5757
flex-grow: 1;
5858
overflow: hidden;
59-
60-
.column_status {
61-
text-transform: capitalize;
62-
}
6359
`
6460
export const SelectAllCheckbox = styled(Checkbox)`
6561
& svg {
6662
margin: 0 !important;
6763
}
6864
`
6965
export const CellText = styled(Text).attrs({
70-
size: 'S',
66+
size: 'M',
7167
component: 'span',
72-
})``
73-
74-
export const CopyPublicEndpointText = styled(CellText)`
68+
})`
7569
max-width: 100%;
7670
display: inline-block;
7771
width: auto;
7872
white-space: nowrap;
7973
text-overflow: ellipsis;
8074
overflow: hidden;
75+
`
76+
77+
export const CopyPublicEndpointText = styled(CellText)`
8178
vertical-align: top;
8279
`
80+
81+
export const StatusColumnText = styled(CellText)`
82+
text-transform: capitalize;
83+
`
8384
export const CopyBtn = styled(IconButton).attrs({
8485
icon: CopyIcon,
8586
size: 'L',

redisinsight/ui/src/components/base/forms/buttons/Button.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from 'react'
33
import { LoaderLargeIcon } from 'uiSrc/components/base/icons'
44
import { BaseButtonProps } from 'uiSrc/components/base/forms/buttons/button.styles'
55
import { Spacer } from 'uiSrc/components/base/layout'
6+
import styled from 'styled-components'
67

78
type ButtonSize = 'small' | 'medium' | 'large'
89
type SizeKey = 'small' | 's' | 'medium' | 'm' | 'large' | 'l'
@@ -62,7 +63,11 @@ export const IconSizes = {
6263
medium: '20px',
6364
large: '24px',
6465
}
65-
66+
const Wrapper = styled.div`
67+
svg {
68+
display: block;
69+
}
70+
`
6671
export const ButtonIcon = ({
6772
buttonSide,
6873
icon,
@@ -87,10 +92,10 @@ export const ButtonIcon = ({
8792
}
8893
const spacer = <Spacer size="s" direction="horizontal" />
8994
return (
90-
<>
95+
<Wrapper>
9196
{buttonSide === 'right' && spacer}
9297
<Button.Icon icon={renderIcon} customSize={iconSize} />
9398
{buttonSide === 'left' && spacer}
94-
</>
99+
</Wrapper>
95100
)
96101
}

redisinsight/ui/src/pages/autodiscover-sentinel/sentinel-databases/components/SentinelDatabases/SentinelDatabases.stories.tsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import {
1313
getRowId,
1414
} from 'uiSrc/pages/autodiscover-sentinel/sentinel-databases/useSentinelDatabasesConfig'
1515

16-
import { StyledContainer } from '../../../../../../../../.storybook/helpers/styles'
17-
1816
const meta: Meta<typeof SentinelDatabases> = {
1917
component: SentinelDatabases,
2018
}
@@ -72,19 +70,17 @@ const DefaultRender = () => {
7270
.map((key) => mastersMock.find((master) => getRowId(master) === key))
7371
.filter((item): item is ModifiedSentinelMaster => Boolean(item))
7472
return (
75-
<StyledContainer paddingSize="m">
76-
<SentinelDatabases
77-
selection={selection || []}
78-
columns={columnsMock}
79-
masters={mastersMock}
80-
onClose={action('onClose')}
81-
onBack={action('onBack')}
82-
onSubmit={action('onSubmit')}
83-
onSelectionChange={(sel) => {
84-
setSelection(sel)
85-
}}
86-
/>
87-
</StyledContainer>
73+
<SentinelDatabases
74+
selection={selection || []}
75+
columns={columnsMock}
76+
masters={mastersMock}
77+
onClose={action('onClose')}
78+
onBack={action('onBack')}
79+
onSubmit={action('onSubmit')}
80+
onSelectionChange={(sel) => {
81+
setSelection(sel)
82+
}}
83+
/>
8884
)
8985
}
9086

redisinsight/ui/src/pages/autodiscover-sentinel/sentinel-databases/components/SentinelDatabases/SentinelDatabases.tsx

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
PrimaryButton,
1313
SecondaryButton,
1414
} from 'uiSrc/components/base/forms/buttons'
15-
import { InfoIcon } from 'uiSrc/components/base/icons'
15+
import { RiIcon } from 'uiSrc/components/base/icons'
1616
import { SearchInput } from 'uiSrc/components/base/inputs'
1717
import { Text } from 'uiSrc/components/base/text'
1818
import { RiPopover, RiTooltip } from 'uiSrc/components/base'
@@ -142,7 +142,6 @@ const SentinelDatabases = ({
142142
button={
143143
<SecondaryButton
144144
onClick={showPopover}
145-
color="secondary"
146145
className="btn-cancel"
147146
data-testid="btn-cancel"
148147
>
@@ -168,8 +167,8 @@ const SentinelDatabases = ({
168167
)
169168

170169
const SubmitButton = ({ onClick }: { onClick: () => void }) => {
171-
let title = null
172-
let content = null
170+
let title: string | null = null
171+
let content: string | null = null
173172
const emptyAliases = selection.filter(({ alias }) => !alias)
174173

175174
if (selection.length < 1) {
@@ -181,24 +180,23 @@ const SentinelDatabases = ({
181180
title = validationErrors.REQUIRED_TITLE(emptyAliases.length)
182181
content = 'Database Alias'
183182
}
183+
const TooltipIcon = () => (
184+
<RiTooltip position="top" title={title} content={<span>{content}</span>}>
185+
<RiIcon type="InfoIcon" />
186+
</RiTooltip>
187+
)
184188

185189
return (
186-
<RiTooltip
187-
position="top"
188-
title={title}
189-
content={isSubmitDisabled() ? <span>{content}</span> : null}
190+
<PrimaryButton
191+
type="submit"
192+
onClick={onClick}
193+
disabled={isSubmitDisabled()}
194+
loading={loading}
195+
icon={isSubmitDisabled() ? TooltipIcon : undefined}
196+
data-testid="btn-add-primary-group"
190197
>
191-
<PrimaryButton
192-
type="submit"
193-
onClick={onClick}
194-
disabled={isSubmitDisabled()}
195-
loading={loading}
196-
icon={isSubmitDisabled() ? InfoIcon : undefined}
197-
data-testid="btn-add-primary-group"
198-
>
199-
Add Primary Group
200-
</PrimaryButton>
201-
</RiTooltip>
198+
Add Primary Group
199+
</PrimaryButton>
202200
)
203201
}
204202

redisinsight/ui/src/pages/autodiscover-sentinel/sentinel-databases/useSentinelDatabasesConfig.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getSelectionColumn } from 'uiSrc/pages/autodiscover-cloud/utils'
1919
import { InputFieldSentinel, RiTooltip } from 'uiSrc/components'
2020
import { SentinelInputFieldType } from 'uiSrc/components/input-field-sentinel/InputFieldSentinel'
2121
import {
22+
CellText,
2223
CopyBtn,
2324
CopyPublicEndpointText,
2425
CopyTextContainer,
@@ -50,7 +51,7 @@ export const colFactory = (
5051
row: {
5152
original: { name },
5253
},
53-
}) => <span data-testid={`primary-group_${name}`}>{name}</span>,
54+
}) => <CellText data-testid={`primary-group_${name}`}>{name}</CellText>,
5455
},
5556
{
5657
header: 'Database Alias*',

0 commit comments

Comments
 (0)