Skip to content

Commit 4e4d32b

Browse files
authored
Ri-7586: issues pointed by Yarden
- set default link size to S - add align=center in EmptyButton.tsx - refactor run button to RunButton.tsx - replace run button in QueryActions.tsx and QueryLiteActions.tsx - replace secondary button with EmptyButton in AddItemsAction.tsx - rework TextInput.tsx, to support passing refs - fix Checkbox.tsx props - use correct key in AppNavigation.tsx - refactor button group usage in KeysHeader.tsx - remove className in HashDetails.tsx, clean up css - add key button, use the existing 'Secondary Invert' button from Redis UI - fix tabs height to be the same as in redis-ui - set ExternalLink.tsx iconSize to 'S'
1 parent c5e9d5f commit 4e4d32b

File tree

30 files changed

+152
-151
lines changed

30 files changed

+152
-151
lines changed

redisinsight/ui/src/components/base/external-link/ExternalLink.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ import ExternalLink from './ExternalLink'
55

66
describe('ExternalLink', () => {
77
it('should render', () => {
8-
expect(render(<ExternalLink />)).toBeTruthy()
8+
expect(render(<ExternalLink href="https://redis.com" />)).toBeTruthy()
99
})
1010
})

redisinsight/ui/src/components/base/external-link/ExternalLink.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
import React from 'react'
22
import { IconProps } from 'uiSrc/components/base/icons'
33
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
4-
import { Link, type LinkProps } from 'uiSrc/components/base/link/Link'
4+
import { Link, type RiLinkProps } from 'uiSrc/components/base/link/Link'
55

6-
export type Props = LinkProps & {
6+
export type Props = RiLinkProps & {
77
href: string
88
iconPosition?: 'left' | 'right'
99
iconSize?: IconProps['size']
10-
variant?: LinkProps['variant']
11-
size?: LinkProps['size']
10+
variant?: RiLinkProps['variant']
11+
size?: RiLinkProps['size']
12+
color?: RiLinkProps['color']
1213
}
1314

1415
const ExternalLink = (props: Props) => {
15-
const { iconPosition = 'right', iconSize = 'M', children, ...rest } = props
16+
const {
17+
iconPosition = 'right',
18+
iconSize = 'S',
19+
size = 'S',
20+
children,
21+
...rest
22+
} = props
1623

1724
const ArrowIcon = () => (
1825
<RiIcon type="ArrowDiagonalIcon" size={iconSize} color="informative400" />

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const EmptyButton = ({
2222
...rest
2323
}: ButtonProps) => (
2424
<TextButton {...rest}>
25-
<Row justify={justify} gap="xs">
25+
<Row justify={justify} gap="s" align="center">
2626
<ButtonIcon
2727
buttonSide="left"
2828
icon={icon}

redisinsight/ui/src/components/base/forms/checkbox/Checkbox.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import {
44
CheckedType,
55
Typography,
66
} from '@redis-ui/components'
7-
import { BodySizesType } from '@redis-ui/components/dist/Typography/components/Body/Body.types'
8-
9-
type Size = BodySizesType
7+
import { BodyProps } from 'uiSrc/components/base/text/text.styles'
108

119
export type CheckboxProps = Omit<
1210
React.ComponentProps<typeof RedisUiCheckbox>,
@@ -16,7 +14,7 @@ export type CheckboxProps = Omit<
1614
onChange?: (e: ChangeEvent<HTMLInputElement>) => void
1715
name?: string
1816
id?: string
19-
labelSize?: Size
17+
labelSize?: BodyProps['size']
2018
}
2119

2220
type CheckboxLabelProps = Omit<
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import React, { ComponentProps } from 'react'
1+
import React, { ComponentProps, forwardRef } from 'react'
22

33
import { Input as RedisInput, TooltipProvider } from '@redis-ui/components'
44

55
export type RedisInputProps = ComponentProps<typeof RedisInput>
66

7-
export default function TextInput(props: RedisInputProps) {
7+
const TextInput = forwardRef<React.ElementRef<typeof RedisInput>, RedisInputProps>((props, ref) => {
88
// eslint-disable-next-line react/destructuring-assignment
99
if (props.error) {
10-
return <TooltipProvider>
11-
<RedisInput {...props} />
12-
</TooltipProvider>
10+
return (
11+
<TooltipProvider>
12+
<RedisInput ref={ref} {...props} />
13+
</TooltipProvider>
14+
)
1315
}
14-
return <RedisInput {...props} />
15-
}
16+
return <RedisInput ref={ref} {...props} />
17+
})
18+
19+
export default TextInput

redisinsight/ui/src/components/base/layout/spacer/spacer.styles.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ export type ThemeSpacingKey = Extract<
99
keyof Theme['core']['space'],
1010
`space${string}`
1111
>
12-
// Allow direct theme spacing values
13-
export type ThemeSpacingValue = Theme['core']['space'][ThemeSpacingKey]
1412

1513
export type SpacerProps = CommonProps &
1614
HTMLAttributes<HTMLDivElement> & {
1715
children?: ReactNode
18-
size?: SpacerSize | ThemeSpacingKey | ThemeSpacingValue
16+
size?: SpacerSize | ThemeSpacingKey
1917
}
2018

2119
export const spacerStyles: Record<SpacerSize, ReturnType<typeof css>> = {
@@ -41,13 +39,12 @@ export const spacerStyles: Record<SpacerSize, ReturnType<typeof css>> = {
4139
}
4240

4341
const isThemeSpacingKey = (
44-
size: SpacerSize | ThemeSpacingKey | ThemeSpacingValue,
42+
size: SpacerSize | ThemeSpacingKey,
4543
theme: Theme,
46-
): size is ThemeSpacingKey =>
47-
typeof size === 'string' && size in theme.core.space
44+
): size is ThemeSpacingKey => size in theme.core.space
4845

4946
const getSpacingValue = (
50-
size: SpacerSize | ThemeSpacingKey | ThemeSpacingValue,
47+
size: SpacerSize | ThemeSpacingKey,
5148
theme: Theme,
5249
): string | ReturnType<typeof css> => {
5350
if (isThemeSpacingKey(size, theme)) {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react'
2-
import { LinkProps } from '@redis-ui/components'
32
export { type LinkProps } from '@redis-ui/components'
4-
import { StyledLink } from 'uiSrc/components/base/link/link.styles'
3+
import { StyledLink, RiLinkProps } from 'uiSrc/components/base/link/link.styles'
4+
export { type RiLinkProps }
55

6-
export const Link = ({ color, ...props }: LinkProps) => (
6+
export const Link = ({ color, ...props }: RiLinkProps) => (
77
<StyledLink {...props} $color={color} />
88
)

redisinsight/ui/src/components/command-helper/components/command-helper-search-output/CHSearchOutput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const CHSearchOutput = ({ searchedCommands }: Props) => {
9090
handleClickCommand(e, command)
9191
}}
9292
>
93-
<UnderlineReverseLink color="text" variant="button">
93+
<UnderlineReverseLink href="#" color="text" variant="inline">
9494
{command}
9595
</UnderlineReverseLink>
9696
</Text>

redisinsight/ui/src/components/consents-settings/ConsentOption/ConsentOption.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import { SwitchInput } from 'uiSrc/components/base/inputs'
1010
import { ItemDescription } from './components'
1111
import { IConsent } from '../ConsentsSettings'
1212

13-
import styles from '../styles.module.scss'
14-
1513
interface Props {
1614
consent: IConsent
1715
onChangeAgreement: (checked: boolean, name: string) => void
@@ -34,7 +32,7 @@ const ConsentOption = (props: Props) => {
3432
{isSettingsPage && consent.description && (
3533
<>
3634
<Spacer size="s" />
37-
<Text size="s" className={styles.smallText} color="primary">
35+
<Text size="M" color="primary">
3836
<ItemDescription
3937
description={consent.description}
4038
withLink={consent.linkToPrivacyPolicy}
@@ -56,11 +54,11 @@ const ConsentOption = (props: Props) => {
5654
/>
5755
</FlexItem>
5856
<FlexItem>
59-
<Text className={styles.smallText}>{parse(consent.label)}</Text>
57+
<Text size="M">{parse(consent.label)}</Text>
6058
{!isSettingsPage && consent.description && (
6159
<>
6260
<Spacer size="s" />
63-
<Text size="s" className={styles.smallText} color="primary">
61+
<Text size="M" color="primary">
6462
<ItemDescription
6563
description={consent.description}
6664
withLink={consent.linkToPrivacyPolicy}

redisinsight/ui/src/components/consents-settings/ConsentOption/components/ItemDescription.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const ItemDescription = ({
1818
{withLink && (
1919
<>
2020
<Link
21+
variant="inline"
2122
color="primary"
2223
target="_blank"
2324
href={getUtmExternalLink(EXTERNAL_LINKS.legalPrivacyPolicy, {

0 commit comments

Comments
 (0)