Skip to content

Commit d05587b

Browse files
committed
feat: refactor tooltip implementation for target platforms and improve styling in related components
1 parent 4bbd5c4 commit d05587b

File tree

5 files changed

+28
-25
lines changed

5 files changed

+28
-25
lines changed

src/Shared/Components/CICDHistory/LogStageAccordion.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { RefCallback } from 'react'
22
import DOMPurify from 'dompurify'
33
import { getTimeDifference } from '@Shared/Helpers'
4-
import { Tooltip } from '@Common/Tooltip'
54
import { ReactComponent as ICCaretDown } from '@Icons/ic-caret-down.svg'
65
import { ReactComponent as ICStack } from '@Icons/ic-stack.svg'
76
import { LogStageAccordionProps } from './types'
@@ -83,21 +82,18 @@ const LogStageAccordion = ({
8382
</div>
8483
</div>
8584

86-
<div className="flexbox dc__gap-8">
85+
<div className="flexbox dc__gap-8 dc__align-items-center">
8786
{!!targetPlatforms?.length && (
8887
<>
89-
<Tooltip
90-
content={<TargetPlatformListTooltip targetPlatforms={targetPlatforms} />}
91-
alwaysShowTippyOnHover
92-
>
88+
<TargetPlatformListTooltip targetPlatforms={targetPlatforms}>
9389
<div className="flexbox dc__gap-4 dc__align-items-center">
9490
<ICStack className="scn-0 dc__no-shrink icon-stroke__white icon-dim-12" />
9591
<span className="text__white fs-13 fw-4 lh-20">
9692
{targetPlatforms.length}&nbsp;target platform
9793
{targetPlatforms.length > 1 ? 's' : ''}
9894
</span>
9995
</div>
100-
</Tooltip>
96+
</TargetPlatformListTooltip>
10197

10298
{!!endTime && <div className="dc__bullet--white dc__bullet" />}
10399
</>

src/Shared/Components/ImageCard/SequentialCDCardTitle/SequentialCDCardTitle.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ARTIFACT_STATUS, STAGE_TYPE } from '../../../constants'
2020
import { DeploymentEnvState } from './DeploymentEnvState'
2121
import { DEPLOYMENT_ENV_TEXT } from './DeploymentEnvState/constants'
2222
import { SequentialCDCardTitleProps } from '../types'
23-
import { ImageTagButton, Tooltip } from '../../../../Common'
23+
import { ImageTagButton } from '../../../../Common'
2424

2525
const SequentialCDCardTitle = ({
2626
isLatest,
@@ -118,11 +118,10 @@ const SequentialCDCardTitle = ({
118118

119119
return (
120120
<div className={`bg__primary pb-8 br-4 flex left ${addFlexGap ? 'dc__gap-8' : ''}`}>
121+
{renderContent()}
122+
121123
{!!targetPlatforms?.length && (
122-
<Tooltip
123-
content={<TargetPlatformListTooltip targetPlatforms={targetPlatforms} />}
124-
alwaysShowTippyOnHover
125-
>
124+
<TargetPlatformListTooltip targetPlatforms={targetPlatforms}>
126125
<div>
127126
<ImageTagButton
128127
text="Multi-arch image"
@@ -134,10 +133,8 @@ const SequentialCDCardTitle = ({
134133
isSuperAdmin
135134
/>
136135
</div>
137-
</Tooltip>
136+
</TargetPlatformListTooltip>
138137
)}
139-
140-
{renderContent()}
141138
</div>
142139
)
143140
}

src/Shared/Components/TargetPlatforms/TargetPlatformBadgeList.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { TargetPlatformBadgeListProps } from './types'
55
const TargetPlatformBadge = ({ name }: TargetPlatformBadgeListProps['targetPlatforms'][number]) => (
66
<div className="bg__secondary py-2 px-6 dc__mxw-200">
77
<Tooltip content={name}>
8-
<span className="dc__truncate cn-7 fs-13 fw-5 lh-20">{name}</span>
8+
<span className="dc__truncate cn-7 fs-12 fw-5 lh-16">{name}</span>
99
</Tooltip>
1010
</div>
1111
)
@@ -16,10 +16,10 @@ const TargetPlatformBadgeList = ({ targetPlatforms }: TargetPlatformBadgeListPro
1616
}
1717

1818
return (
19-
<div className="flexbox dc__gap-8 dc__align-items-center">
20-
<ICStack className="icon-dim-16 dc__no-shrink scn-7" />
19+
<div className="flexbox dc__gap-8 dc__align-start">
20+
<ICStack className="icon-dim-20 dc__no-shrink scn-7 p-2" />
2121

22-
<div className="flexbox dc__gap-8 flex-wrap">
22+
<div className="flexbox dc__gap-6 flex-wrap">
2323
{targetPlatforms.map(({ name }) => (
2424
<TargetPlatformBadge key={name} name={name} />
2525
))}
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
import { Tooltip } from '@Common/Tooltip'
12
import { TargetPlatformListTooltipProps } from './types'
23

3-
const TargetPlatformListTooltip = ({ targetPlatforms }: TargetPlatformListTooltipProps) => (
4-
<div className="flexbox-col dc__gap-2 fs-12 lh-18 cn-0 w-200">
5-
<h6 className="m-0 fw-6">Target platforms</h6>
4+
const TooltipContent = ({ targetPlatforms }: Pick<TargetPlatformListTooltipProps, 'targetPlatforms'>) => (
5+
<div className="flexbox-col dc__gap-4">
6+
<h6 className="m-0 fw-6 lh-18 fs-12">Target platforms</h6>
67

7-
<ul className="pl-12 m-0">
8+
<ul className="pl-12 m-0 dc__overflow-auto mxh-140">
89
{targetPlatforms.map(({ name }) => (
9-
<li key={name} className="dc__word-break">
10+
<li key={name} className="dc__word-break lh-18">
1011
{name}
1112
</li>
1213
))}
1314
</ul>
1415
</div>
1516
)
1617

18+
const TargetPlatformListTooltip = ({ targetPlatforms, children }: TargetPlatformListTooltipProps) => (
19+
<Tooltip content={<TooltipContent targetPlatforms={targetPlatforms} />} alwaysShowTippyOnHover interactive>
20+
{children}
21+
</Tooltip>
22+
)
23+
1724
export default TargetPlatformListTooltip
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { TooltipProps } from '@Common/Tooltip/types'
12
import { TargetPlatformsDTO } from '@Shared/types'
23

34
export interface TargetPlatformBadgeListProps extends Pick<TargetPlatformsDTO, 'targetPlatforms'> {}
4-
export interface TargetPlatformListTooltipProps extends Pick<TargetPlatformsDTO, 'targetPlatforms'> {}
5+
export interface TargetPlatformListTooltipProps extends Pick<TargetPlatformsDTO, 'targetPlatforms'> {
6+
children: TooltipProps['children']
7+
}

0 commit comments

Comments
 (0)