Skip to content

Commit d6b13fc

Browse files
authored
feat: add tooltips to header buttons (#274)
1 parent 68b425f commit d6b13fc

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

src/extension/react/components/Panel.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ function Panel() {
219219
<div className="font-medium dark:text-charcoal-100">Devtron</div>
220220
<div className="flex gap-2">
221221
<CircularButton
222+
tooltip="Switch between Light and Dark theme"
222223
onClick={() => {
223224
setTheme(theme === 'light' ? 'dark' : 'light');
224225
}}
@@ -230,6 +231,7 @@ function Panel() {
230231
)}
231232
</CircularButton>
232233
<CircularButton
234+
tooltip="Toggle Detail Panel position (right/bottom)"
233235
onClick={() => {
234236
setDetailPanelPosition(detailPanelPosition === 'right' ? 'bottom' : 'right');
235237
}}
@@ -242,6 +244,11 @@ function Panel() {
242244
</CircularButton>
243245

244246
<CircularButton
247+
tooltip={
248+
lockToBottom
249+
? 'Turn Auto Scrolling Off'
250+
: 'Turn Auto Scrolling On (Auto Scroll to newly added events)'
251+
}
245252
active={lockToBottom}
246253
onClick={() => {
247254
setLockToBottom(!lockToBottom);
@@ -255,7 +262,7 @@ function Panel() {
255262
)}
256263
</CircularButton>
257264

258-
<CircularButton onClick={clearEvents}>
265+
<CircularButton tooltip="Clear all events" onClick={clearEvents}>
259266
<Ban strokeWidth={3} size={15} />
260267
</CircularButton>
261268
</div>

src/extension/react/ui/CircularButton.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ type Props = {
77
active?: boolean;
88
};
99

10-
function CircularButton({ children, onClick, disabled = false, active = false }: Props) {
10+
function CircularButton({
11+
children,
12+
onClick,
13+
tooltip = '',
14+
disabled = false,
15+
active = false,
16+
}: Props) {
1117
return (
12-
<div>
13-
<button
14-
disabled={disabled}
15-
className={`${active ? 'text-blue-500' : 'text-charcoal-200'} rounded-full p-1 ${
16-
disabled
17-
? 'cursor-not-allowed opacity-50'
18-
: 'cursor-pointer hover:bg-gray-300 hover:dark:bg-charcoal-300'
19-
}`}
20-
onClick={() => onClick()}
21-
>
22-
{children}
23-
</button>
24-
</div>
18+
<button
19+
title={tooltip}
20+
disabled={disabled}
21+
className={`${active ? 'text-blue-500' : 'text-charcoal-200'} rounded-full p-1 ${
22+
disabled
23+
? 'cursor-not-allowed opacity-50'
24+
: 'cursor-pointer hover:bg-gray-300 hover:dark:bg-charcoal-300'
25+
}`}
26+
onClick={() => onClick()}
27+
>
28+
{children}
29+
</button>
2530
);
2631
}
2732

0 commit comments

Comments
 (0)