Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
83b6eec2
Unverified
Commit
83b6eec2
authored
May 19, 2022
by
Jordan Frankfurt
Committed by
GitHub
May 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(copy-icon): makes copy icon configurable for different uses (#3853)
parent
cd76fffb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
25 deletions
+34
-25
Copy.tsx
src/components/AccountDetails/Copy.tsx
+23
-17
index.tsx
src/components/AccountDetails/index.tsx
+5
-5
index.tsx
src/components/ConnectedAccountBlocked/index.tsx
+6
-3
No files found.
src/components/AccountDetails/Copy.tsx
View file @
83b6eec2
...
@@ -10,7 +10,6 @@ const CopyIcon = styled(LinkStyledButton)`
...
@@ -10,7 +10,6 @@ const CopyIcon = styled(LinkStyledButton)`
flex-shrink: 0;
flex-shrink: 0;
display: flex;
display: flex;
text-decoration: none;
text-decoration: none;
font-size: 12px;
:hover,
:hover,
:active,
:active,
:focus {
:focus {
...
@@ -18,20 +17,36 @@ const CopyIcon = styled(LinkStyledButton)`
...
@@ -18,20 +17,36 @@ const CopyIcon = styled(LinkStyledButton)`
color:
${({
color
,
theme
})
=>
color
||
theme
.
text2
}
;
color:
${({
color
,
theme
})
=>
color
||
theme
.
text2
}
;
}
}
`
`
const
TransactionStatus
Text
=
styled
.
span
`
const
Styled
Text
=
styled
.
span
`
margin-left: 0.25rem;
margin-left: 0.25rem;
font-size: 12px;
${({
theme
})
=>
theme
.
flexRowNoWrap
}
;
${({
theme
})
=>
theme
.
flexRowNoWrap
}
;
align-items: center;
align-items: center;
`
`
const
Copied
=
({
iconSize
}:
{
iconSize
?:
number
})
=>
(
<
StyledText
>
<
CheckCircle
size=
{
iconSize
??
'
16
'
}
/>
<
StyledText
>
<
Trans
>
Copied
</
Trans
>
</
StyledText
>
</
StyledText
>
)
const
Icon
=
({
iconSize
}:
{
iconSize
?:
number
})
=>
(
<
StyledText
>
<
Copy
size=
{
iconSize
??
'
16
'
}
/>
</
StyledText
>
)
interface
BaseProps
{
interface
BaseProps
{
toCopy
:
string
toCopy
:
string
color
?:
string
color
?:
string
iconSize
?:
number
iconPosition
?:
'
left
'
|
'
right
'
}
}
export
type
CopyHelperProps
=
BaseProps
&
Omit
<
React
.
ButtonHTMLAttributes
<
HTMLButtonElement
>
,
keyof
BaseProps
>
export
type
CopyHelperProps
=
BaseProps
&
Omit
<
React
.
ButtonHTMLAttributes
<
HTMLButtonElement
>
,
keyof
BaseProps
>
export
default
function
CopyHelper
({
color
,
toCopy
,
children
}:
CopyHelperProps
)
{
export
default
function
CopyHelper
({
color
,
toCopy
,
children
,
iconSize
,
iconPosition
}:
CopyHelperProps
)
{
const
[
isCopied
,
setCopied
]
=
useCopyClipboard
()
const
[
isCopied
,
setCopied
]
=
useCopyClipboard
()
const
copy
=
useCallback
(()
=>
{
const
copy
=
useCallback
(()
=>
{
setCopied
(
toCopy
)
setCopied
(
toCopy
)
...
@@ -39,20 +54,11 @@ export default function CopyHelper({ color, toCopy, children }: CopyHelperProps)
...
@@ -39,20 +54,11 @@ export default function CopyHelper({ color, toCopy, children }: CopyHelperProps)
return
(
return
(
<
CopyIcon
onClick=
{
copy
}
color=
{
color
}
>
<
CopyIcon
onClick=
{
copy
}
color=
{
color
}
>
{
iconPosition
===
'
left
'
?
isCopied
?
<
Copied
iconSize=
{
iconSize
}
/>
:
<
Icon
iconSize=
{
iconSize
}
/>
:
null
}
{
iconPosition
===
'
left
'
&&
<>
</>
}
{
isCopied
?
''
:
children
}
{
isCopied
?
''
:
children
}
{
iconPosition
===
'
right
'
&&
<>
</>
}
{
isCopied
?
(
{
iconPosition
===
'
right
'
?
isCopied
?
<
Copied
iconSize=
{
iconSize
}
/>
:
<
Icon
iconSize=
{
iconSize
}
/>
:
null
}
<
TransactionStatusText
>
<
CheckCircle
size=
{
'
12
'
}
/>
<
TransactionStatusText
>
<
Trans
>
Copied
</
Trans
>
</
TransactionStatusText
>
</
TransactionStatusText
>
)
:
(
<
TransactionStatusText
>
<
Copy
size=
{
'
12
'
}
/>
</
TransactionStatusText
>
)
}
</
CopyIcon
>
</
CopyIcon
>
)
)
}
}
src/components/AccountDetails/index.tsx
View file @
83b6eec2
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Trans
}
from
'
@lingui/macro
'
import
{
Connector
}
from
'
@web3-react/types
'
import
{
Connector
}
from
'
@web3-react/types
'
import
CopyHelper
from
'
components/AccountDetails/Copy
'
import
useActiveWeb3React
from
'
hooks/useActiveWeb3React
'
import
useActiveWeb3React
from
'
hooks/useActiveWeb3React
'
import
{
useCallback
,
useContext
}
from
'
react
'
import
{
useCallback
,
useContext
}
from
'
react
'
import
{
ExternalLink
as
LinkIcon
}
from
'
react-feather
'
import
{
ExternalLink
as
LinkIcon
}
from
'
react-feather
'
...
@@ -17,7 +18,6 @@ import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
...
@@ -17,7 +18,6 @@ import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
import
{
ButtonSecondary
}
from
'
../Button
'
import
{
ButtonSecondary
}
from
'
../Button
'
import
StatusIcon
from
'
../Identicon/StatusIcon
'
import
StatusIcon
from
'
../Identicon/StatusIcon
'
import
{
AutoRow
}
from
'
../Row
'
import
{
AutoRow
}
from
'
../Row
'
import
Copy
from
'
./Copy
'
import
Transaction
from
'
./Transaction
'
import
Transaction
from
'
./Transaction
'
const
HeaderRow
=
styled
.
div
`
const
HeaderRow
=
styled
.
div
`
...
@@ -310,11 +310,11 @@ export default function AccountDetails({
...
@@ -310,11 +310,11 @@ export default function AccountDetails({
<
AccountControl
>
<
AccountControl
>
<
div
>
<
div
>
{
account
&&
(
{
account
&&
(
<
Copy
toCopy=
{
account
}
>
<
Copy
Helper
toCopy=
{
account
}
iconPosition=
"left"
>
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
<
Trans
>
Copy Address
</
Trans
>
<
Trans
>
Copy Address
</
Trans
>
</
span
>
</
span
>
</
Copy
>
</
Copy
Helper
>
)
}
)
}
{
chainId
&&
account
&&
(
{
chainId
&&
account
&&
(
<
AddressLink
<
AddressLink
...
@@ -336,11 +336,11 @@ export default function AccountDetails({
...
@@ -336,11 +336,11 @@ export default function AccountDetails({
<
AccountControl
>
<
AccountControl
>
<
div
>
<
div
>
{
account
&&
(
{
account
&&
(
<
Copy
toCopy=
{
account
}
>
<
Copy
Helper
toCopy=
{
account
}
iconPosition=
"left"
>
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
<
span
style=
{
{
marginLeft
:
'
4px
'
}
}
>
<
Trans
>
Copy Address
</
Trans
>
<
Trans
>
Copy Address
</
Trans
>
</
span
>
</
span
>
</
Copy
>
</
Copy
Helper
>
)
}
)
}
{
chainId
&&
account
&&
(
{
chainId
&&
account
&&
(
<
AddressLink
<
AddressLink
...
...
src/components/ConnectedAccountBlocked/index.tsx
View file @
83b6eec2
...
@@ -18,6 +18,9 @@ const WarningIcon = styled(AlertOctagon)`
...
@@ -18,6 +18,9 @@ const WarningIcon = styled(AlertOctagon)`
min-width: 22px;
min-width: 22px;
color:
${({
theme
})
=>
theme
.
warning
}
;
color:
${({
theme
})
=>
theme
.
warning
}
;
`
`
const
Copy
=
styled
(
CopyHelper
)
`
font-size: 12px;
`
interface
ConnectedAccountBlockedProps
{
interface
ConnectedAccountBlockedProps
{
account
:
string
|
null
|
undefined
account
:
string
|
null
|
undefined
...
@@ -46,9 +49,9 @@ export default function ConnectedAccountBlocked(props: ConnectedAccountBlockedPr
...
@@ -46,9 +49,9 @@ export default function ConnectedAccountBlocked(props: ConnectedAccountBlockedPr
<
ThemedText
.
Main
fontSize=
{
12
}
>
<
ThemedText
.
Main
fontSize=
{
12
}
>
<
Trans
>
If you believe this is an error, please send an email including your address to
</
Trans
>
{
'
'
}
<
Trans
>
If you believe this is an error, please send an email including your address to
</
Trans
>
{
'
'
}
</
ThemedText
.
Main
>
</
ThemedText
.
Main
>
<
Copy
Helper
toCopy=
"compliance@uniswap.org"
color=
{
theme
.
primary1
}
>
<
Copy
iconSize=
{
12
}
toCopy=
"compliance@uniswap.org"
color=
{
theme
.
primary1
}
iconPosition=
"right"
>
compliance@uniswap.org
.
compliance@uniswap.org
</
Copy
Helper
>
</
Copy
>
</
ContentWrapper
>
</
ContentWrapper
>
</
Modal
>
</
Modal
>
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment