Skip to content

Commit 70bc521

Browse files
committed
feat: add more buttons to url exploder tool
1 parent 3d5e1aa commit 70bc521

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

plugins/toolbox/src/components/Buttons/CopyToClipboardButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import React from 'react';
44

55
type Props = {
66
output: string | number;
7+
title?: string;
78
};
89

910
export const CopyToClipboardButton = (props: Props) => {
@@ -13,7 +14,7 @@ export const CopyToClipboardButton = (props: Props) => {
1314
};
1415

1516
return (
16-
<Tooltip arrow title="Copy output to clipboard">
17+
<Tooltip arrow title={props.title ?? 'Copy output to clipboard'}>
1718
<Button size="small" startIcon={<FileCopy />} onClick={copyToClipboard}>
1819
Copy
1920
</Button>

plugins/toolbox/src/components/Buttons/PasteFromClipboardButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import AssignmentReturnedIcon from '@material-ui/icons/AssignmentReturned';
44

55
type Props = {
66
setInput: (input: string) => void;
7+
title?: string;
78
};
89

910
export const PasteFromClipboardButton = (props: Props) => {
@@ -14,7 +15,7 @@ export const PasteFromClipboardButton = (props: Props) => {
1415
);
1516
};
1617
return (
17-
<Tooltip arrow title="Paste input from clipboard">
18+
<Tooltip arrow title={props.title ?? 'Paste input from clipboard'}>
1819
<Button
1920
size="small"
2021
startIcon={<AssignmentReturnedIcon />}

plugins/toolbox/src/components/Misc/UrlExploder.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import React, { useEffect, useState } from 'react';
22
import { Grid, TextField } from '@material-ui/core';
33
import { useStyles } from '../../utils/hooks';
4-
import { SampleButton } from '../Buttons';
4+
import {
5+
ClearValueButton,
6+
CopyToClipboardButton,
7+
PasteFromClipboardButton,
8+
SampleButton,
9+
} from '../Buttons';
510
import { faker } from '@faker-js/faker';
611

712
const UrlExploder = () => {
@@ -75,12 +80,24 @@ const UrlExploder = () => {
7580
<Grid container>
7681
<Grid item xs={12}>
7782
<SampleButton setInput={onInput} sample={faker.internet.url()} />
83+
<ClearValueButton setValue={onInput} />
84+
<PasteFromClipboardButton
85+
title="Paste URL from clipboard"
86+
setInput={onInput}
87+
/>
88+
{rawInput && (
89+
<CopyToClipboardButton
90+
title="Copy URL to clipboard"
91+
output={rawInput}
92+
/>
93+
)}
7894
<TextField
7995
label="URL"
8096
variant="outlined"
8197
className={styles.fullWidth}
8298
value={rawInput}
8399
onChange={e => onInput(e.target.value)}
100+
style={{ marginTop: '10px', marginBottom: '10px' }}
84101
/>
85102
</Grid>
86103
<Grid item xs={6}>

0 commit comments

Comments
 (0)