Skip to content

Commit c5e9d5f

Browse files
authored
RI-7541: Fix key details header (#5026)
* remove hard coded select container widths and heights * align the arrows icon in the center * leave just one formatter icon with currentColor set by the theme * make the icon smaller
1 parent 72a5e02 commit c5e9d5f

File tree

6 files changed

+10
-78
lines changed

6 files changed

+10
-78
lines changed
Lines changed: 2 additions & 2 deletions
Loading

redisinsight/ui/src/assets/img/icons/formatter_light.svg

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

redisinsight/ui/src/components/base/icons/iconRegistry.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ import RedisTimeSeriesDark from 'uiSrc/assets/img/modules/RedisTimeSeriesDark.sv
112112
import RedisTimeSeriesLight from 'uiSrc/assets/img/modules/RedisTimeSeriesLight.svg?react'
113113
import UnknownDark from 'uiSrc/assets/img/modules/UnknownDark.svg?react'
114114
import UnknownLight from 'uiSrc/assets/img/modules/UnknownLight.svg?react'
115-
import FormattersLight from 'uiSrc/assets/img/icons/formatter_light.svg?react'
116-
import FormattersDark from 'uiSrc/assets/img/icons/formatter_dark.svg?react'
115+
import FormatterSvg from 'uiSrc/assets/img/icons/formatter.svg?react'
117116

118117
// Import options icons
119118
import ActiveActiveDark from 'uiSrc/assets/img/options/Active-ActiveDark.svg?react'
@@ -257,8 +256,7 @@ export const OutputDarkIcon = createIconComponent(OutputDarkSvg)
257256
export const OutputIconIcon = createIconComponent(OutputIconBaseSvg)
258257

259258
// Modules icons
260-
export const FormattersLightIcon = createIconComponent(FormattersLight)
261-
export const FormattersDarkIcon = createIconComponent(FormattersDark)
259+
export const FormatterIcon = createIconComponent(FormatterSvg)
262260
export const RedisAIDarkIcon = createIconComponent(RedisAIDark)
263261
export const RedisAILightIcon = createIconComponent(RedisAILight)
264262
export const RedisBloomDarkIcon = createIconComponent(RedisBloomDark)

redisinsight/ui/src/pages/browser/modules/key-details-header/components/key-details-header-formatter/KeyDetailsHeaderFormatter.styles.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ type KeyDetailsSelectProps = ComponentProps<typeof RiSelect> & {
1111
const KeyDetailsSelect = styled(RiSelect)<KeyDetailsSelectProps>`
1212
border: none !important;
1313
background-color: inherit !important;
14-
color: var(--iconsDefaultColor) !important;
15-
max-width: ${({ $fullWidth }) => ($fullWidth ? '100%' : '92px')};
14+
max-width: 100%;
1615
padding-right: 18px;
1716
padding-left: 0;
1817
height: 28px;
@@ -41,8 +40,8 @@ const ControlsIcon = styled(RiIcon)`
4140
position: relative;
4241
margin-left: 3px;
4342
margin-top: 2px;
44-
width: 20px !important;
45-
height: 20px !important;
43+
width: 17px !important;
44+
height: 17px !important;
4645
4746
:global(.insightsOpen) {
4847
@media only screen and (max-width: 1440px) {
@@ -56,11 +55,11 @@ const Container = styled.div<{
5655
className?: string
5756
children: React.ReactNode
5857
}>`
59-
margin-right: 12px;
58+
display: flex;
59+
align-items: center;
6060
height: 30px;
6161
border-radius: 4px;
6262
transition: transform 0.3s ease;
63-
width: 92px;
6463
overflow: hidden;
6564
6665
&:hover {
@@ -76,15 +75,6 @@ const Container = styled.div<{
7675
height: 100%;
7776
}
7877
79-
.selectWrapper {
80-
width: 142px;
81-
position: absolute;
82-
83-
[class*='TriggerContainer'] {
84-
width: 92px;
85-
}
86-
}
87-
8878
&:not(.fullWidth) {
8979
width: 56px;
9080

redisinsight/ui/src/pages/browser/modules/key-details-header/components/key-details-header-formatter/KeyDetailsHeaderFormatter.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import {
77
KeyValueFormat,
88
MIDDLE_SCREEN_RESOLUTION,
99
TEXT_DISABLED_STRING_FORMATTING,
10-
Theme,
1110
} from 'uiSrc/constants'
12-
import { ThemeContext } from 'uiSrc/contexts/themeContext'
1311
import {
1412
keysSelector,
1513
selectedKeyDataSelector,
@@ -40,7 +38,6 @@ const KeyDetailsHeaderFormatter = (props: Props) => {
4038
const { width } = props
4139

4240
const { instanceId = '' } = useParams<{ instanceId: string }>()
43-
const { theme } = useContext(ThemeContext)
4441
const { viewType } = useSelector(keysSelector)
4542
const { viewFormat } = useSelector(selectedKeySelector)
4643
const { type: keyType, length } = useSelector(selectedKeyDataSelector) ?? {}
@@ -78,11 +75,7 @@ const KeyDetailsHeaderFormatter = (props: Props) => {
7875
<OptionText>{text}</OptionText>
7976
) : (
8077
<ControlsIcon
81-
type={
82-
theme === Theme.Dark
83-
? 'FormattersDarkIcon'
84-
: 'FormattersLightIcon'
85-
}
78+
type="FormatterIcon"
8679
data-testid={`key-value-formatter-option-selected-${value}`}
8780
/>
8881
)}

redisinsight/ui/src/pages/browser/modules/key-details-header/components/key-details-header-formatter/styles.module.scss

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
.container {
2-
margin-right: 12px;
3-
height: 30px;
42
border-radius: 4px;
53
transition: transform 0.3s ease;
6-
width: 92px;
74
overflow: hidden;
85

96
&:hover {
@@ -14,25 +11,8 @@
1411
transform: translateY(1px);
1512
}
1613

17-
:global(.euiFormControlLayout) {
18-
height: 100%;
19-
}
20-
21-
.selectWrapper {
22-
width: 142px;
23-
position: absolute;
24-
25-
:global(.euiFormControlLayout__childrenWrapper) {
26-
width: 92px;
27-
}
28-
}
29-
3014
&:not(.fullWidth) {
3115
width: 46px;
32-
33-
:global(.euiFormControlLayout__childrenWrapper) {
34-
width: 46px;
35-
}
3616
}
3717

3818
.optionText {
@@ -47,36 +27,11 @@
4727
}
4828
}
4929

50-
.changeView:global(.euiSuperSelectControl) {
51-
border: none !important;
52-
background-color: inherit !important;
53-
color: var(--iconsDefaultColor) !important;
54-
min-width: 46px;
55-
padding-right: 18px;
56-
padding-left: 0;
57-
height: 28px;
58-
59-
& ~ div {
60-
right: 7px;
61-
top: 4px;
62-
svg {
63-
width: 10px !important;
64-
height: 10px !important;
65-
}
66-
}
67-
}
68-
6930
.formatType {
7031
margin-top: 3px;
7132
margin-bottom: 3px;
7233
padding: 6px !important;
7334
min-height: 36px !important;
74-
75-
:global(.euiContextMenu__icon) {
76-
height: 14px;
77-
width: 14px;
78-
margin-right: 6px;
79-
}
8035
}
8136

8237
.optionText {

0 commit comments

Comments
 (0)