Skip to content

Commit b171681

Browse files
committed
wip: update badge colors
1 parent 82a9e1e commit b171681

File tree

2 files changed

+59
-58
lines changed

2 files changed

+59
-58
lines changed

redisinsight/ui/src/components/bottom-group-components/components/bottom-group-minimized/BottomGroupMinimized.tsx

Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect } from 'react'
22
import { useDispatch, useSelector } from 'react-redux'
33
import { useParams } from 'react-router-dom'
4-
import styled from 'styled-components'
54

65
import { EXTERNAL_LINKS } from 'uiSrc/constants/links'
76
import {
@@ -24,59 +23,17 @@ import { FeatureFlags } from 'uiSrc/constants'
2423
import { Text } from 'uiSrc/components/base/text'
2524
import { FlexItem, Row } from 'uiSrc/components/base/layout/flex'
2625
import { HideFor, ShowFor } from 'uiSrc/components/base/utils/ShowHide'
27-
import { RiBadge } from 'uiSrc/components/base/display/badge/RiBadge'
2826
import {
2927
CliIcon,
3028
DocumentationIcon,
3129
ProfilerIcon,
3230
} from 'uiSrc/components/base/icons'
3331
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
3432
import styles from '../../styles.module.scss'
35-
36-
const ComponentBadge = styled(RiBadge)<{ isActive?: boolean }>`
37-
background-color: transparent !important;
38-
color: var(--euiTextSubduedColor) !important;
39-
height: 18px !important;
40-
border: none !important;
41-
cursor: pointer;
42-
user-select: none;
43-
44-
&[title] {
45-
pointer-events: none;
46-
}
47-
48-
${({ isActive, theme }) => {
49-
// TODO: try to replace with semantic colors once the palette is bigger.
50-
const bgColorActive =
51-
theme.name === 'dark' ? theme.color.azure600 : theme.color.azure200
52-
const bgColorHover =
53-
theme.name === 'dark' ? theme.color.azure500 : theme.color.azure300
54-
55-
const color =
56-
theme.name === 'dark' ? theme.color.azure200 : theme.color.azure600
57-
58-
return `
59-
${isActive ? `background-color: ${bgColorActive} !important;` : ''}
60-
${isActive ? `color: ${color} !important;` : ''}
61-
&:hover {
62-
background-color: ${bgColorHover} !important;
63-
color: ${color} !important;
64-
}
65-
`
66-
}}
67-
`
68-
69-
const ContainerMinimized = styled.div`
70-
display: flex;
71-
align-items: center;
72-
padding-left: ${({ theme }) => theme.core.space.space050};
73-
height: 26px;
74-
line-height: 26px;
75-
border-left: 1px solid
76-
${({ theme }) => theme.semantic.color.border.neutral500};
77-
border-right: 1px solid
78-
${({ theme }) => theme.semantic.color.border.neutral500};
79-
`
33+
import {
34+
ComponentBadge,
35+
ContainerMinimized,
36+
} from './ButtonGroupMinimized.styles'
8037

8138
const BottomGroupMinimized = () => {
8239
const { instanceId = '' } = useParams<{ instanceId: string }>()
@@ -138,11 +95,7 @@ const BottomGroupMinimized = () => {
13895
return (
13996
<ContainerMinimized>
14097
<Row align="center" responsive={false} style={{ height: '100%' }} gap="s">
141-
<FlexItem
142-
className={styles.componentBadgeItem}
143-
onClick={handleExpandCli}
144-
data-testid="expand-cli"
145-
>
98+
<FlexItem onClick={handleExpandCli} data-testid="expand-cli">
14699
<ComponentBadge
147100
withIcon
148101
icon={CliIcon}
@@ -156,7 +109,6 @@ const BottomGroupMinimized = () => {
156109
</FlexItem>
157110

158111
<FlexItem
159-
className={styles.componentBadgeItem}
160112
onClick={handleExpandHelper}
161113
data-testid="expand-command-helper"
162114
>
@@ -172,11 +124,7 @@ const BottomGroupMinimized = () => {
172124
/>
173125
</FlexItem>
174126
<FeatureFlagComponent name={FeatureFlags.envDependent}>
175-
<FlexItem
176-
className={styles.componentBadgeItem}
177-
onClick={handleExpandMonitor}
178-
data-testid="expand-monitor"
179-
>
127+
<FlexItem onClick={handleExpandMonitor} data-testid="expand-monitor">
180128
<ComponentBadge
181129
withIcon
182130
icon={ProfilerIcon}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import styled from 'styled-components'
2+
3+
import { RiBadge } from 'uiSrc/components/base/display/badge/RiBadge'
4+
5+
export const ComponentBadge = styled(RiBadge)<{ isActive?: boolean }>`
6+
height: 18px !important;
7+
border: none !important;
8+
cursor: pointer;
9+
user-select: none;
10+
11+
&[title] {
12+
pointer-events: none;
13+
}
14+
15+
${({ isActive, theme }) => {
16+
console.log('theme', theme)
17+
// TODO: try to replace with semantic colors once the palette is bigger.
18+
const bgColorActive =
19+
theme.name === 'dark'
20+
? theme.semantic.color.background.primary300
21+
: theme.semantic.color.background.primary300
22+
const bgColorHover =
23+
theme.name === 'dark'
24+
? theme.semantic.color.background.primary500
25+
: theme.semantic.color.background.primary200
26+
27+
const color =
28+
theme.name === 'dark'
29+
? theme.semantic.color.text.primary600
30+
: theme.semantic.color.text.primary600
31+
32+
return `
33+
${isActive ? `background-color: ${bgColorActive} !important;` : ''}
34+
${isActive ? `color: ${color} !important;` : ''}
35+
&:hover {
36+
background-color: ${bgColorHover} !important;
37+
color: ${color} !important;
38+
}
39+
`
40+
}}
41+
`
42+
43+
export const ContainerMinimized = styled.div`
44+
display: flex;
45+
align-items: center;
46+
padding-left: ${({ theme }) => theme.core.space.space050};
47+
height: 26px;
48+
line-height: 26px;
49+
border-left: 1px solid
50+
${({ theme }) => theme.semantic.color.border.neutral500};
51+
border-right: 1px solid
52+
${({ theme }) => theme.semantic.color.border.neutral500};
53+
`

0 commit comments

Comments
 (0)