Skip to content

Commit 2c52df8

Browse files
authored
RI-4764: Fix insights bulb highlight style (#5018)
1 parent 24818d1 commit 2c52df8

File tree

3 files changed

+62
-71
lines changed

3 files changed

+62
-71
lines changed

redisinsight/ui/src/components/triggers/insights-trigger/InsightsTrigger.tsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React, { useEffect } from 'react'
2-
import cx from 'classnames'
3-
42
import { useDispatch, useSelector } from 'react-redux'
53
import { useLocation, useParams } from 'react-router-dom'
4+
65
import {
76
changeSelectedTab,
87
changeSidePanel,
@@ -23,10 +22,14 @@ import {
2322
} from 'uiSrc/telemetry'
2423
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
2524

26-
import { IconButton } from 'uiSrc/components/base/forms/buttons'
2725
import { LightBulbIcon } from 'uiSrc/components/base/icons'
2826
import { RiTooltip } from 'uiSrc/components'
29-
import styles from './styles.module.scss'
27+
28+
import {
29+
BulbHighlighting,
30+
BulbIconButton,
31+
BulbWrapper,
32+
} from './insights-trigger.styles'
3033

3134
export interface Props {
3235
source?: string
@@ -79,29 +82,26 @@ const InsightsTrigger = (props: Props) => {
7982
}
8083

8184
return (
82-
<div className={cx(styles.container, { [styles.isOpen]: isInsightsOpen })}>
83-
<RiTooltip
84-
title={isHighlighted && instanceId ? undefined : 'Insights'}
85-
content={
86-
isHighlighted && instanceId
87-
? 'New tips are available'
88-
: 'Open interactive tutorials to learn more about Redis or Redis Stack capabilities, or use tips to improve your database.'
89-
}
90-
>
91-
<IconButton
85+
<RiTooltip
86+
title={isHighlighted && instanceId ? undefined : 'Insights'}
87+
content={
88+
isHighlighted && instanceId
89+
? 'New tips are available'
90+
: 'Open interactive tutorials to learn more about Redis or Redis Stack capabilities, or use tips to improve your database.'
91+
}
92+
>
93+
<BulbWrapper>
94+
<BulbIconButton
9295
size="S"
93-
className={styles.btn}
9496
role="button"
9597
icon={LightBulbIcon}
9698
onClick={handleClickTrigger}
9799
data-testid="insights-trigger"
98-
>
99-
{isHighlighted && instanceId && (
100-
<span className={styles.highlighting} />
101-
)}
102-
</IconButton>
103-
</RiTooltip>
104-
</div>
100+
isOpen={isInsightsOpen}
101+
/>
102+
{isHighlighted && instanceId && <BulbHighlighting />}
103+
</BulbWrapper>
104+
</RiTooltip>
105105
)
106106
}
107107

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import styled, { css } from "styled-components"
2+
3+
import { IconButton } from "uiSrc/components/base/forms/buttons"
4+
import { IconButtonProps } from "uiSrc/components/base/forms/buttons/IconButton"
5+
6+
export const BulbWrapper = styled.div`
7+
position: relative;
8+
`
9+
10+
export const BulbHighlighting = styled.span`
11+
// TODO: Using the background color from the previous value until there is an appropriate color
12+
// from the pallete to use for both light and dark themes.
13+
background-color: #ffaf2b;
14+
position: absolute;
15+
left: 5px;
16+
top: 5px;
17+
width: 10px;
18+
height: 10px;
19+
border-radius: 50%;
20+
border: 1px solid ${({ theme }) => theme.color.gray100};
21+
`
22+
23+
export const BulbIconButton = styled(IconButton)<
24+
{ isOpen: boolean } & IconButtonProps
25+
>`
26+
padding: ${({ theme }) => theme.core.space.space200};
27+
28+
// TODO: Remove this once size property is enabled for IconButton
29+
svg {
30+
width: 21px;
31+
height: 21px;
32+
}
33+
34+
${({ isOpen }) =>
35+
isOpen &&
36+
css`
37+
background-color: ${({ theme }) =>
38+
theme.semantic.color.background.primary200} !important;
39+
`}
40+
`

redisinsight/ui/src/components/triggers/insights-trigger/styles.module.scss

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

0 commit comments

Comments
 (0)