Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions redisinsight/ui/src/components/base/link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ import {
} from 'uiSrc/components/base/link/link.styles'
export { type RiLinkProps }

export const Link = ({ color, ...props }: RiLinkProps) => (
<StyledLink {...props} $color={color} />
export const Link = ({ color, underline, ...props }: RiLinkProps) => (
<StyledLink {...props} $color={color} $underline={underline} />
)
8 changes: 6 additions & 2 deletions redisinsight/ui/src/components/base/link/link.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ export type ColorType = LinkProps['color'] | EuiColorNames | (string & {})

export type RiLinkProps = Omit<LinkProps, 'color'> & {
color?: ColorType
underline?: boolean
}

type MapProps = RiLinkProps & {
$color?: ColorType
$underline?: boolean
}

export const useColorTextStyles = ({ $color }: MapProps = {}) => {
Expand Down Expand Up @@ -65,9 +67,11 @@ export const useColorTextStyles = ({ $color }: MapProps = {}) => {

export const StyledLink = styled(RedisUiLink)<MapProps>`
${useColorTextStyles};
text-decoration: none !important;
text-decoration: ${({ $underline }) =>
$underline ? 'underline' : 'none'} !important;
& > span {
text-decoration: none !important;
text-decoration: ${({ $underline }) =>
$underline ? 'underline' : 'none'} !important;
}
&:hover {
text-decoration: underline !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { EditIcon } from 'uiSrc/components/base/icons'
import { Text } from 'uiSrc/components/base/text'
import { NumericInput } from 'uiSrc/components/base/inputs'
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
import { Link } from 'uiSrc/components/base/link/Link'
import InstancesNavigationPopover from './components/instances-navigation-popover'
import styles from './styles.module.scss'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip: In the last few weeks, I have tried to remove all the SASS styles and migrate them to styled components when I deal with a particular component.

If you find the styles of these components to be simple enough, you can go for it as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a dedicated tech debt task on the matter. I'd rather keep this PR short.
I usually do what you are saying as well, but only if I touch more components and half or fewer remain is sass


Expand Down Expand Up @@ -159,19 +160,20 @@ const InstanceHeader = ({ onChangeDbIndex }: Props) => {
: 'Redis Databases'
}
>
<Text
className={styles.breadCrumbLink}
<Link
color="subdued"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most of the places we go away from this legacy EUI subdued color, is there a reason why we use it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the default color of our Link is overrided for some reason. This color is the bluish one

underline
variant="inline"
aria-label={
server?.buildType === BuildType.RedisStack
? 'Edit database'
: 'Redis Databases'
}
data-testid="my-redis-db-btn"
onClick={goHome}
onKeyDown={goHome}
>
Databases
</Text>
</Link>
</RiTooltip>
</FeatureFlagComponent>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styled from 'styled-components'

import { Row } from 'uiSrc/components/base/layout/flex'

export const ButtonWrapper = styled(Row)`
cursor: pointer;
`
Comment on lines +5 to +7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this comment is valid but I saw we used role="button" property in other places to achieve this. or i'm missing something

Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import { localStorageService } from 'uiSrc/services'
import { filterAndSort } from 'uiSrc/utils'
import { Spacer } from 'uiSrc/components/base/layout/spacer'
import { Text } from 'uiSrc/components/base/text'
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
import Tabs, { TabInfo } from 'uiSrc/components/base/layout/tabs'
import { RiPopover } from 'uiSrc/components/base'
import InstancesList from './components/instances-list'
import { ChevronDownIcon } from 'uiSrc/components/base/icons'
import { ButtonWrapper } from './InstancesNavigationPopover.styles'
import styles from './styles.module.scss'

export interface Props {
Expand Down Expand Up @@ -117,16 +118,15 @@ const InstancesNavigationPopover = ({ name }: Props) => {
isOpen={isPopoverOpen}
closePopover={() => showPopover()}
button={
<Text
className={styles.showPopoverBtn}
<ButtonWrapper
align="center"
gap="s"
onClick={() => showPopover()}
data-testid="nav-instance-popover-btn"
>
<b className={styles.breadCrumbLink}>{name}</b>
<span>
<RiIcon color="primary500" type="CaretDownIcon" />
</span>
</Text>
<Text color="primary">{name}</Text>
<ChevronDownIcon size="S" />
</ButtonWrapper>
}
>
<div className={styles.wrapper}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
.showPopoverBtn {
display: flex;
justify-content: flex-start;
align-items: center;
gap: 4px;
cursor: pointer;
}

.breadCrumbLink {
cursor: pointer;
text-decoration: underline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features'
import { isAnyFeatureEnabled } from 'uiSrc/utils/features'
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
import { Text } from 'uiSrc/components/base/text'
import { Link } from 'uiSrc/components/base/link/Link'
import InstancesNavigationPopover from '../instance-header/components/instances-navigation-popover'
import styles from './styles.module.scss'

Expand Down Expand Up @@ -43,22 +44,23 @@ const RdiInstanceHeader = () => {
>
<div>
<RiTooltip position="bottom" content="My RDI instances">
<Text
className={styles.breadCrumbLink}
<Link
color="subdued"
underline
variant="inline"
aria-label="My RDI instances"
data-testid="my-rdi-instances-btn"
onClick={goHome}
onKeyDown={goHome}
>
RDI instances
</Text>
Data integration
</Link>
</RiTooltip>
</div>
<div style={{ flex: 1, overflow: 'hidden' }}>
<div style={{ maxWidth: '100%' }}>
<Row align="center">
<FlexItem>
<Text className={styles.divider}>&#62;</Text>
<Text className={styles.divider}>/</Text>
</FlexItem>
<FlexItem grow style={{ overflow: 'hidden' }}>
<InstancesNavigationPopover name={name} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@
& > div {
display: flex;
}

.breadCrumbLink {
color: var(--euiColorPrimary) !important;
font-size: 14px !important;
line-height: 20px;
font-weight: 400;
cursor: pointer;
text-decoration: underline;

&:hover {
text-decoration: none;
}
}
}

.rdiName {
Expand Down
Loading