Skip to content

Commit db867a6

Browse files
committed
fix recommendation styles
1 parent 653939c commit db867a6

File tree

1 file changed

+54
-49
lines changed
  • redisinsight/ui/src/components/side-panels/panels/live-time-recommendations/components/recommendation

1 file changed

+54
-49
lines changed

redisinsight/ui/src/components/side-panels/panels/live-time-recommendations/components/recommendation/Recommendation.tsx

Lines changed: 54 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useContext } from 'react'
22
import { useDispatch } from 'react-redux'
33
import { useHistory, useParams } from 'react-router-dom'
4+
import styled from 'styled-components'
45
import { isUndefined } from 'lodash'
56

67
import { findTutorialPath, Maybe, Nullable } from 'uiSrc/utils'
@@ -33,13 +34,12 @@ import {
3334
} from 'uiSrc/components/base/icons'
3435

3536
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'
3738
import { Card } from 'uiSrc/components/base/layout'
3839
import {
3940
IconButton,
4041
SecondaryButton,
4142
} from 'uiSrc/components/base/forms/buttons'
42-
import { Text } from 'uiSrc/components/base/text'
4343
import { RiIcon } from 'uiSrc/components/base/icons/RiIcon'
4444
import { RiAccordion } from 'uiSrc/components/base/display/accordion/RiAccordion'
4545
import { Link } from 'uiSrc/components/base/link/Link'
@@ -58,6 +58,10 @@ export interface IProps {
5858
recommendationsContent: IRecommendationsStatic
5959
}
6060

61+
const RecommendationContent = styled(Card)`
62+
padding: var(--size-m);
63+
`
64+
6165
const RecommendationTitle = ({
6266
redisStack,
6367
title,
@@ -76,6 +80,7 @@ const RecommendationTitle = ({
7680
style={{
7781
maxWidth: '60%',
7882
textAlign: 'left',
83+
overflow: 'hidden',
7984
}}
8085
>
8186
{redisStack && (
@@ -104,7 +109,9 @@ const RecommendationTitle = ({
104109
</Link>
105110
</FlexItem>
106111
)}
107-
<FlexItem className="truncateText">{title}</FlexItem>
112+
<div className="truncateText">
113+
<span title={title}>{title}</span>
114+
</div>
108115
</Row>
109116
)
110117
}
@@ -197,7 +204,7 @@ const Recommendation = ({
197204
}
198205

199206
const recommendationContent = () => (
200-
<Text>
207+
<Col>
201208
{!isUndefined(tutorialId) && (
202209
<SecondaryButton
203210
filled
@@ -237,52 +244,47 @@ const Recommendation = ({
237244
/>
238245
</div>
239246
</FeatureFlagComponent>
240-
</Text>
247+
</Col>
241248
)
242249

243250
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>
286288
</Row>
287289
)
288290

@@ -309,9 +311,12 @@ const Recommendation = ({
309311
data-testid={`${name}-accordion`}
310312
aria-label={`${name}-accordion`}
311313
>
312-
<Card className={styles.accordionContent} color="subdued">
314+
<RecommendationContent
315+
className={styles.accordionContent}
316+
color="subdued"
317+
>
313318
{recommendationContent()}
314-
</Card>
319+
</RecommendationContent>
315320
</RiAccordion>
316321
</div>
317322
)

0 commit comments

Comments
 (0)