File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
plugins/toolbox/src/components Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import React from 'react';
4
4
5
5
type Props = {
6
6
output : string | number ;
7
+ title ?: string ;
7
8
} ;
8
9
9
10
export const CopyToClipboardButton = ( props : Props ) => {
@@ -13,7 +14,7 @@ export const CopyToClipboardButton = (props: Props) => {
13
14
} ;
14
15
15
16
return (
16
- < Tooltip arrow title = " Copy output to clipboard" >
17
+ < Tooltip arrow title = { props . title ?? ' Copy output to clipboard' } >
17
18
< Button size = "small" startIcon = { < FileCopy /> } onClick = { copyToClipboard } >
18
19
Copy
19
20
</ Button >
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import AssignmentReturnedIcon from '@material-ui/icons/AssignmentReturned';
4
4
5
5
type Props = {
6
6
setInput : ( input : string ) => void ;
7
+ title ?: string ;
7
8
} ;
8
9
9
10
export const PasteFromClipboardButton = ( props : Props ) => {
@@ -14,7 +15,7 @@ export const PasteFromClipboardButton = (props: Props) => {
14
15
) ;
15
16
} ;
16
17
return (
17
- < Tooltip arrow title = " Paste input from clipboard" >
18
+ < Tooltip arrow title = { props . title ?? ' Paste input from clipboard' } >
18
19
< Button
19
20
size = "small"
20
21
startIcon = { < AssignmentReturnedIcon /> }
Original file line number Diff line number Diff line change 1
1
import React , { useEffect , useState } from 'react' ;
2
2
import { Grid , TextField } from '@material-ui/core' ;
3
3
import { useStyles } from '../../utils/hooks' ;
4
- import { SampleButton } from '../Buttons' ;
4
+ import {
5
+ ClearValueButton ,
6
+ CopyToClipboardButton ,
7
+ PasteFromClipboardButton ,
8
+ SampleButton ,
9
+ } from '../Buttons' ;
5
10
import { faker } from '@faker-js/faker' ;
6
11
7
12
const UrlExploder = ( ) => {
@@ -75,12 +80,24 @@ const UrlExploder = () => {
75
80
< Grid container >
76
81
< Grid item xs = { 12 } >
77
82
< 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
+ ) }
78
94
< TextField
79
95
label = "URL"
80
96
variant = "outlined"
81
97
className = { styles . fullWidth }
82
98
value = { rawInput }
83
99
onChange = { e => onInput ( e . target . value ) }
100
+ style = { { marginTop : '10px' , marginBottom : '10px' } }
84
101
/>
85
102
</ Grid >
86
103
< Grid item xs = { 6 } >
You can’t perform that action at this time.
0 commit comments