Skip to content

Commit a5ea658

Browse files
committed
fix: tooltip on hover of fullscreen button
1 parent b4c990d commit a5ea658

File tree

3 files changed

+44
-15
lines changed

3 files changed

+44
-15
lines changed

src/Shared/Components/CICDHistory/History.components.tsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import Tippy from '@tippyjs/react'
1818
import { useEffect } from 'react'
1919
import { useLocation } from 'react-router-dom'
20-
import { ClipboardButton, GenericEmptyState, extractImage, useKeyDown, useSuperAdmin } from '../../../Common'
20+
import { ClipboardButton, GenericEmptyState, Tooltip, extractImage, useKeyDown, useSuperAdmin } from '../../../Common'
2121
import { EMPTY_STATE_STATUS } from '../../constants'
2222
import { ReactComponent as DropDownIcon } from '../../../Assets/Icon/ic-chevron-down.svg'
2323
import { GitChangesType, LogResizeButtonType, ScrollerType } from './types'
@@ -28,7 +28,7 @@ import { ReactComponent as ZoomOut } from '../../../Assets/Icon/ic-exit-fullscre
2828
import './cicdHistory.scss'
2929

3030
export const LogResizeButton = ({
31-
shortcutCombo = 'f',
31+
shortcutCombo = ['F'],
3232
onlyOnLogs = true,
3333
disableKeybindings = false,
3434
fullScreenView,
@@ -57,22 +57,31 @@ export const LogResizeButton = ({
5757
}
5858
}, [keys])
5959

60+
const renderFullscreenTooltipContent = () => (
61+
<div className="flexbox dc__gap-8 px-8 py-4">
62+
<span className="lh-18 fs-12 fw-4 cn-0">{fullScreenView ? 'Exit fullscreen' : 'Enter fullscreen'}</span>
63+
<div className="flexbox dc__gap-4">
64+
{shortcutCombo.map((key) => (
65+
<span key={key} className="shortcut-keys__chip dc__capitalize lh-16 fs-11 fw-5 flex">
66+
{key}
67+
</span>
68+
))}
69+
</div>
70+
</div>
71+
)
72+
6073
return (
6174
(pathname.includes('/logs') || !onlyOnLogs) && (
62-
<Tippy
63-
placement="top"
64-
arrow={false}
65-
className="default-tt"
66-
content={fullScreenView ? `Exit fullscreen (${shortcutCombo})` : `Enter fullscreen (${shortcutCombo})`}
75+
<Tooltip
76+
placement="left"
77+
className="shortcut-keys__tippy"
78+
content={renderFullscreenTooltipContent()}
79+
alwaysShowTippyOnHover
6780
>
68-
<div>
69-
{fullScreenView ? (
70-
<ZoomOut className="zoom zoom--out pointer dc__zi-4" onClick={toggleFullScreen} />
71-
) : (
72-
<ZoomIn className="zoom zoom--in pointer dc__zi-4" onClick={toggleFullScreen} />
73-
)}
81+
<div className={`zoom ${fullScreenView ? 'zoom--out' : 'zoom--in'} pointer dc__zi-4 flex`}>
82+
{fullScreenView ? <ZoomOut onClick={toggleFullScreen} /> : <ZoomIn onClick={toggleFullScreen} />}
7483
</div>
75-
</Tippy>
84+
</Tooltip>
7685
)
7786
)
7887
}

src/Shared/Components/CICDHistory/cicdHistory.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,3 +294,23 @@
294294
width: min(100%, 800px);
295295
}
296296
}
297+
298+
.shortcut-keys__chip {
299+
border-radius: 4px;
300+
border: 0.5px solid rgba(255, 255, 255, 0.20);
301+
background: var(--N800);
302+
box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.20);
303+
padding: 0 2px;
304+
min-width: 16px;
305+
max-width: 250px;
306+
}
307+
308+
.tippy-box.shortcut-keys__tippy {
309+
border-radius: 4px;
310+
border: 1px solid rgba(255, 255, 255, 0.20);
311+
background: var(--N900);
312+
313+
& > .tippy-content {
314+
padding: 0;
315+
}
316+
}

src/Shared/Components/CICDHistory/types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export enum FetchIdDataStatus {
4646
}
4747

4848
export interface LogResizeButtonType {
49-
shortcutCombo?: string
49+
shortcutCombo?: string[]
5050
onlyOnLogs?: boolean
5151
disableKeybindings?: boolean
5252
fullScreenView: boolean

0 commit comments

Comments
 (0)