Skip to content

Commit 1b134b0

Browse files
committed
fix: refactor CopyButton and Auth components for improved readability and layout
1 parent d2f6faa commit 1b134b0

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/app/views/common/copy-button/CopyButtonV9.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { useState, useRef } from 'react';
21
import { Button, Tooltip, makeStyles } from '@fluentui/react-components';
3-
import { translateMessage } from '../../../utils/translate-messages';
42
import { CheckmarkRegular, CopyRegular } from '@fluentui/react-icons';
3+
import { useRef, useState } from 'react';
4+
import { translateMessage } from '../../../utils/translate-messages';
55

66
interface ICopyButtonProps {
77
style?: React.CSSProperties;
8-
handleOnClick: Function;
8+
handleOnClick: (props: ICopyButtonProps) => void;
99
className?: string;
1010
isIconButton: boolean;
1111
}
@@ -23,7 +23,9 @@ export default function CopyButton(props: ICopyButtonProps) {
2323
const copyRef = useRef<HTMLButtonElement>(null);
2424
const styles = useStyles();
2525

26-
const copyLabel: string = !copied ? translateMessage('Copy') : translateMessage('Copied');
26+
const copyLabel: string = !copied
27+
? translateMessage('Copy')
28+
: translateMessage('Copied');
2729

2830
const handleCopyClick = async () => {
2931
props.handleOnClick(props);
@@ -40,9 +42,9 @@ export default function CopyButton(props: ICopyButtonProps) {
4042
return (
4143
<>
4244
{props.isIconButton ? (
43-
<Tooltip content={copyLabel} relationship='label'>
45+
<Tooltip withArrow content={copyLabel} relationship='label'>
4446
<Button
45-
appearance="subtle"
47+
appearance='subtle'
4648
icon={copied ? <CheckmarkRegular /> : <CopyRegular />}
4749
aria-label={copyLabel}
4850
onClick={handleCopyClick}
@@ -52,14 +54,10 @@ export default function CopyButton(props: ICopyButtonProps) {
5254
/>
5355
</Tooltip>
5456
) : (
55-
<Button
56-
appearance="primary"
57-
onClick={handleCopyClick}
58-
ref={copyRef}
59-
>
57+
<Button appearance='primary' onClick={handleCopyClick} ref={copyRef}>
6058
{copyLabel}
6159
</Button>
6260
)}
6361
</>
6462
);
65-
}
63+
}

src/app/views/query-runner/request/auth/AuthV9.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const useStyles = makeStyles({
3535
accessToken: {
3636
wordWrap: 'break-word',
3737
width: 'calc(100vw - var(--sidebar-size) - 4rem)',
38+
padding: tokens.spacingHorizontalXS,
3839
height: '100%',
3940
border: 'none',
4041
resize: 'none'
@@ -59,7 +60,7 @@ export function Auth() {
5960
);
6061
const authToken = useAppSelector((state) => state.auth.authToken);
6162
const { user } = profile;
62-
const requestHeight = convertVhToPx(height, 60);
63+
const requestHeight = convertVhToPx(height, 5);
6364
const [accessToken, setAccessToken] = useState<string | null>(null);
6465
const [loading, setLoading] = useState(false);
6566

@@ -105,6 +106,7 @@ export function Auth() {
105106
</Text>
106107
<CopyButton isIconButton={true} handleOnClick={handleCopy} />
107108
<Tooltip
109+
withArrow
108110
content={translateMessage(showMessage())}
109111
relationship='label'
110112
>

0 commit comments

Comments
 (0)