Skip to content

Commit 10689ba

Browse files
#RI-2957 - update styles, max and min range value (#677)
* #RI-2957 - update styles, max and min range value
1 parent b9be009 commit 10689ba

File tree

3 files changed

+91
-24
lines changed

3 files changed

+91
-24
lines changed

redisinsight/ui/src/components/range-filter/RangeFilter.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export interface Props {
1414
end: number
1515
handleChangeStart: (value: number, shouldSentEventTelemetry: boolean) => void
1616
handleChangeEnd: (value: number, shouldSentEventTelemetry: boolean) => void
17+
handleUpdateRangeMax: (value: number) => void
18+
handleUpdateRangeMin: (value: number) => void
1719
handleResetFilter: () => void
1820
}
1921

@@ -26,7 +28,17 @@ function usePrevious(value: any) {
2628
}
2729

2830
const RangeFilter = (props: Props) => {
29-
const { max, min, start, end, handleChangeStart, handleChangeEnd, handleResetFilter } = props
31+
const {
32+
max,
33+
min,
34+
start,
35+
end,
36+
handleChangeStart,
37+
handleChangeEnd,
38+
handleUpdateRangeMax,
39+
handleUpdateRangeMin,
40+
handleResetFilter
41+
} = props
3042

3143
const [startVal, setStartVal] = useState(start)
3244
const [endVal, setEndVal] = useState(end)
@@ -44,9 +56,10 @@ const RangeFilter = (props: Props) => {
4456

4557
const onChangeStart = useCallback(
4658
({ target: { value } }) => {
47-
setStartVal(value)
59+
const newValue = Math.min(+value, endVal - 1)
60+
setStartVal(newValue)
4861
},
49-
[]
62+
[endVal]
5063
)
5164

5265
const onMouseUpStart = useCallback(
@@ -65,9 +78,10 @@ const RangeFilter = (props: Props) => {
6578

6679
const onChangeEnd = useCallback(
6780
({ target: { value } }) => {
68-
setEndVal(value)
81+
const newValue = Math.max(+value, startVal + 1)
82+
setEndVal(newValue)
6983
},
70-
[]
84+
[startVal]
7185
)
7286

7387
useEffect(() => {
@@ -103,10 +117,10 @@ const RangeFilter = (props: Props) => {
103117

104118
useEffect(() => {
105119
if (max && prevValue && prevValue.max !== max && end === prevValue.max) {
106-
handleChangeEnd(max, false)
120+
handleUpdateRangeMax(max)
107121
}
108122
if (min && prevValue && prevValue.min !== min && start === prevValue.min) {
109-
handleChangeStart(min, false)
123+
handleUpdateRangeMin(min)
110124
}
111125
}, [prevValue])
112126

redisinsight/ui/src/components/range-filter/styles.module.scss

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@
3737
z-index: 1;
3838
}
3939

40-
.sliderRange {
41-
height: 5px;
40+
.rangeWrapper .sliderRange {
41+
height: 1px;
4242
background-color: var(--euiColorPrimary);
4343
z-index: 2;
44+
transform: translateY(2px);
45+
}
46+
47+
.rangeWrapper:hover .sliderRange {
48+
height: 5px;
49+
transform: translateY(0px);
4450
}
4551

4652
.sliderLeftValue,
@@ -56,6 +62,14 @@
5662
margin-top: -30px;
5763
}
5864

65+
.rangeWrapper:hover .sliderLeftValue {
66+
margin-top: -28px;
67+
}
68+
69+
.rangeWrapper:hover .sliderRightValue {
70+
margin-top: 22px;
71+
}
72+
5973
.sliderLeftValue.leftPosition {
6074
transform: translateX(-100%);
6175
}
@@ -96,39 +110,62 @@
96110
}
97111

98112
.thumb::-moz-range-thumb {
99-
width: 2px;
113+
width: 24px;
100114
height: 12px;
101-
background-color: var(--euiColorPrimary);
102115
border: none;
116+
border-radius: 0;
103117
cursor: ew-resize;
104118
margin-top: 4px;
105119
pointer-events: all;
106120
position: relative;
121+
background: transparent;
122+
border-bottom: 1px solid var(--euiColorPrimary);
123+
border-left: 1px solid var(--euiColorPrimary);
124+
}
125+
126+
.rangeWrapper:hover .thumb::-moz-range-thumb {
127+
border-bottom: 5px solid var(--euiColorPrimary);
107128
}
108129

109130
.thumbZindex3::-moz-range-thumb {
110131
transform: translateY(-4px);
111132
}
112133

113134
.thumbZindex4::-moz-range-thumb {
114-
transform: translateY(8px);
135+
transform: translateY(8px) rotate(180deg);
115136
}
116137

117138
input[type='range']::-webkit-slider-thumb {
118-
width: 2px;
139+
width: 24px;
119140
height: 12px;
120-
background-color: var(--euiColorPrimary);
121141
border: none;
142+
border-radius: 0;
122143
cursor: ew-resize;
123144
margin-top: 4px;
124145
pointer-events: all;
125146
position: relative;
147+
background: transparent;
148+
border-bottom: 1px solid var(--euiColorPrimary);
149+
border-left: 1px solid var(--euiColorPrimary);
150+
}
151+
152+
.rangeWrapper:hover input[type='range']::-webkit-slider-thumb{
153+
border-bottom: 5px solid var(--euiColorPrimary);
154+
margin-top: 2px;
126155
}
127156

128157
input[type='range']:first-child::-webkit-slider-thumb {
129-
transform: translateY(-4px);
158+
transform: translateY(-5px);
130159
}
131160

132161
input[type='range']:last-of-type::-webkit-slider-thumb {
133-
transform: translateY(8px);
162+
transform: translateY(6px) rotate(180deg);
134163
}
164+
165+
.rangeWrapper:hover input[type='range']:first-child::-webkit-slider-thumb {
166+
transform: translateY(-2px);
167+
}
168+
169+
.rangeWrapper:hover input[type='range']:last-of-type::-webkit-slider-thumb {
170+
transform: translateY(5px) rotate(180deg);
171+
}

redisinsight/ui/src/pages/browser/components/stream-details/StreamDetails/StreamDetails.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,20 @@ const StreamDetails = (props: Props) => {
173173
[lastEntryTimeStamp, firstEntryTimeStamp]
174174
)
175175

176+
const handleUpdateRangeMin = useCallback(
177+
(min: number) => {
178+
dispatch(updateStart(min.toString()))
179+
},
180+
[]
181+
)
182+
183+
const handleUpdateRangeMax = useCallback(
184+
(max: number) => {
185+
dispatch(updateEnd(max.toString()))
186+
},
187+
[]
188+
)
189+
176190
useEffect(() => {
177191
if (isNull(firstEntry)) {
178192
dispatch(updateStart(''))
@@ -193,6 +207,14 @@ const StreamDetails = (props: Props) => {
193207

194208
return (
195209
<>
210+
{loading && (
211+
<EuiProgress
212+
color="primary"
213+
size="xs"
214+
position="absolute"
215+
data-testid="progress-key-stream"
216+
/>
217+
)}
196218
{shouldFilterRender ? (
197219
<RangeFilter
198220
max={lastEntryTimeStamp}
@@ -202,6 +224,8 @@ const StreamDetails = (props: Props) => {
202224
handleChangeStart={handleChangeStartFilter}
203225
handleChangeEnd={handleChangeEndFilter}
204226
handleResetFilter={handleResetFilter}
227+
handleUpdateRangeMax={handleUpdateRangeMax}
228+
handleUpdateRangeMin={handleUpdateRangeMin}
205229
/>
206230
)
207231
: (
@@ -218,14 +242,6 @@ const StreamDetails = (props: Props) => {
218242
)}
219243
data-test-id="stream-entries-container"
220244
>
221-
{loading && (
222-
<EuiProgress
223-
color="primary"
224-
size="xs"
225-
position="absolute"
226-
data-testid="progress-key-stream"
227-
/>
228-
)}
229245
{/* <div className={styles.columnManager}>
230246
<EuiButtonIcon iconType="boxesVertical" aria-label="manage columns" />
231247
</div> */}

0 commit comments

Comments
 (0)