1
1
import React , { useContext } from 'react'
2
2
import { useDispatch } from 'react-redux'
3
3
import { useHistory , useParams } from 'react-router-dom'
4
+ import styled from 'styled-components'
4
5
import { isUndefined } from 'lodash'
5
6
6
7
import { findTutorialPath , Maybe , Nullable } from 'uiSrc/utils'
@@ -33,13 +34,12 @@ import {
33
34
} from 'uiSrc/components/base/icons'
34
35
35
36
import { openTutorialByPath } from 'uiSrc/slices/panels/sidePanels'
36
- import { FlexItem , Row } from 'uiSrc/components/base/layout/flex'
37
+ import { Col , FlexItem , Row } from 'uiSrc/components/base/layout/flex'
37
38
import { Card } from 'uiSrc/components/base/layout'
38
39
import {
39
40
IconButton ,
40
41
SecondaryButton ,
41
42
} from 'uiSrc/components/base/forms/buttons'
42
- import { Text } from 'uiSrc/components/base/text'
43
43
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
44
44
import { RiAccordion } from 'uiSrc/components/base/display/accordion/RiAccordion'
45
45
import { Link } from 'uiSrc/components/base/link/Link'
@@ -58,6 +58,10 @@ export interface IProps {
58
58
recommendationsContent : IRecommendationsStatic
59
59
}
60
60
61
+ const RecommendationContent = styled ( Card ) `
62
+ padding: var(--size-m);
63
+ `
64
+
61
65
const RecommendationTitle = ( {
62
66
redisStack,
63
67
title,
@@ -76,6 +80,7 @@ const RecommendationTitle = ({
76
80
style = { {
77
81
maxWidth : '60%' ,
78
82
textAlign : 'left' ,
83
+ overflow : 'hidden' ,
79
84
} }
80
85
>
81
86
{ redisStack && (
@@ -104,7 +109,9 @@ const RecommendationTitle = ({
104
109
</ Link >
105
110
</ FlexItem >
106
111
) }
107
- < FlexItem className = "truncateText" > { title } </ FlexItem >
112
+ < div className = "truncateText" >
113
+ < span title = { title } > { title } </ span >
114
+ </ div >
108
115
</ Row >
109
116
)
110
117
}
@@ -197,7 +204,7 @@ const Recommendation = ({
197
204
}
198
205
199
206
const recommendationContent = ( ) => (
200
- < Text >
207
+ < Col >
201
208
{ ! isUndefined ( tutorialId ) && (
202
209
< SecondaryButton
203
210
filled
@@ -237,52 +244,47 @@ const Recommendation = ({
237
244
/>
238
245
</ div >
239
246
</ FeatureFlagComponent >
240
- </ Text >
247
+ </ Col >
241
248
)
242
249
243
250
const renderButtonContent = (
244
- < Row className = { styles . fullWidth } align = "center" justify = "between" >
245
- < Row className = { styles . fullWidth } align = "center" >
246
- < FlexItem grow className = "truncateText" >
247
- { title }
248
- </ FlexItem >
249
- < FlexItem >
250
- < RiTooltip
251
- title = "Snooze tip"
252
- content = "This tip will be removed from the list and displayed again when relevant."
253
- position = "top"
254
- anchorClassName = "flex-row"
255
- >
256
- < IconButton
257
- icon = { SnoozeIcon }
258
- className = { styles . snoozeBtn }
259
- onClick = { handleDelete }
260
- aria-label = "snooze tip"
261
- data-testid = { `${ name } -delete-btn` }
262
- />
263
- </ RiTooltip >
264
- </ FlexItem >
265
- < FlexItem >
266
- < RiTooltip
267
- title = { `${ hide ? 'Show' : 'Hide' } tip` }
268
- content = { `${
269
- hide
270
- ? 'This tip will be shown in the list.'
271
- : 'This tip will be removed from the list and not displayed again.'
272
- } `}
273
- position = "top"
274
- anchorClassName = "flex-row"
275
- >
276
- < IconButton
277
- icon = { hide ? HideIcon : ShowIcon }
278
- className = { styles . hideBtn }
279
- onClick = { toggleHide }
280
- aria-label = "hide/unhide tip"
281
- data-testid = { `toggle-hide-${ name } -btn` }
282
- />
283
- </ RiTooltip >
284
- </ FlexItem >
285
- </ Row >
251
+ < Row className = { styles . fullWidth } align = "center" gap = "s" justify = "between" >
252
+ < FlexItem >
253
+ < RiTooltip
254
+ title = "Snooze tip"
255
+ content = "This tip will be removed from the list and displayed again when relevant."
256
+ position = "top"
257
+ anchorClassName = "flex-row"
258
+ >
259
+ < IconButton
260
+ icon = { SnoozeIcon }
261
+ className = { styles . snoozeBtn }
262
+ onClick = { handleDelete }
263
+ aria-label = "snooze tip"
264
+ data-testid = { `${ name } -delete-btn` }
265
+ />
266
+ </ RiTooltip >
267
+ </ FlexItem >
268
+ < FlexItem >
269
+ < RiTooltip
270
+ title = { `${ hide ? 'Show' : 'Hide' } tip` }
271
+ content = { `${
272
+ hide
273
+ ? 'This tip will be shown in the list.'
274
+ : 'This tip will be removed from the list and not displayed again.'
275
+ } `}
276
+ position = "top"
277
+ anchorClassName = "flex-row"
278
+ >
279
+ < IconButton
280
+ icon = { hide ? HideIcon : ShowIcon }
281
+ className = { styles . hideBtn }
282
+ onClick = { toggleHide }
283
+ aria-label = "hide/unhide tip"
284
+ data-testid = { `toggle-hide-${ name } -btn` }
285
+ />
286
+ </ RiTooltip >
287
+ </ FlexItem >
286
288
</ Row >
287
289
)
288
290
@@ -309,9 +311,12 @@ const Recommendation = ({
309
311
data-testid = { `${ name } -accordion` }
310
312
aria-label = { `${ name } -accordion` }
311
313
>
312
- < Card className = { styles . accordionContent } color = "subdued" >
314
+ < RecommendationContent
315
+ className = { styles . accordionContent }
316
+ color = "subdued"
317
+ >
313
318
{ recommendationContent ( ) }
314
- </ Card >
319
+ </ RecommendationContent >
315
320
</ RiAccordion >
316
321
</ div >
317
322
)
0 commit comments