fix: fix copy button styling (#4473)
* fix copy button styling * fix positionig * preserve original css for token safety warning use case
This commit is contained in:
parent
ac27c89a44
commit
874f3fb737
@ -46,6 +46,7 @@ const ContractAddress = styled.button`
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
|
min-height: 38px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
`
|
`
|
||||||
|
@ -32,7 +32,7 @@ export const ChartHeader = styled.div`
|
|||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
`
|
`
|
||||||
export const ContractAddressSection = styled.div`
|
export const ContractAddressSection = styled.div`
|
||||||
padding: 24px 0px;
|
padding: 36px 0px;
|
||||||
`
|
`
|
||||||
export const ChartContainer = styled.div`
|
export const ChartContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -212,33 +212,42 @@ export function ExternalLinkIcon({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const ToolTipWrapper = styled.div`
|
const ToolTipWrapper = styled.div<{ isCopyContractTooltip?: boolean }>`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: absolute;
|
position: ${({ isCopyContractTooltip }) => (isCopyContractTooltip ? 'relative' : 'absolute')};
|
||||||
|
right: ${({ isCopyContractTooltip }) => isCopyContractTooltip && '50%'};
|
||||||
transform: translate(5px, 32px);
|
transform: translate(5px, 32px);
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
`
|
`
|
||||||
|
|
||||||
const CopiedTooltip = styled.div`
|
const StyledTooltipTriangle = styled(TooltipTriangle)`
|
||||||
|
path {
|
||||||
|
fill: ${({ theme }) => theme.black};
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const CopiedTooltip = styled.div<{ isCopyContractTooltip?: boolean }>`
|
||||||
background-color: ${({ theme }) => theme.black};
|
background-color: ${({ theme }) => theme.black};
|
||||||
text-align: center;
|
text-align: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 60px;
|
width: ${({ isCopyContractTooltip }) => !isCopyContractTooltip && '60px'};
|
||||||
height: 32px;
|
height: ${({ isCopyContractTooltip }) => !isCopyContractTooltip && '32px'};
|
||||||
line-height: 32px;
|
line-height: ${({ isCopyContractTooltip }) => !isCopyContractTooltip && '32px'};
|
||||||
|
|
||||||
|
padding: ${({ isCopyContractTooltip }) => isCopyContractTooltip && '8px'};
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
|
||||||
color: ${({ theme }) => theme.white};
|
color: ${({ theme }) => theme.white};
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
`
|
`
|
||||||
|
|
||||||
function ToolTip() {
|
function Tooltip({ isCopyContractTooltip }: { isCopyContractTooltip: boolean }) {
|
||||||
return (
|
return (
|
||||||
<ToolTipWrapper>
|
<ToolTipWrapper isCopyContractTooltip={isCopyContractTooltip}>
|
||||||
<TooltipTriangle />
|
<StyledTooltipTriangle />
|
||||||
<CopiedTooltip>Copied!</CopiedTooltip>
|
<CopiedTooltip isCopyContractTooltip={isCopyContractTooltip}>Copied!</CopiedTooltip>
|
||||||
</ToolTipWrapper>
|
</ToolTipWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -259,7 +268,7 @@ export function CopyLinkIcon({ toCopy }: { toCopy: string }) {
|
|||||||
return (
|
return (
|
||||||
<CopyIconWrapper onClick={copy}>
|
<CopyIconWrapper onClick={copy}>
|
||||||
<CopyIcon />
|
<CopyIcon />
|
||||||
{isCopied && <ToolTip />}
|
{isCopied && <Tooltip isCopyContractTooltip={false} />}
|
||||||
</CopyIconWrapper>
|
</CopyIconWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -309,7 +318,7 @@ export function CopyContractAddress({ address }: { address: string }) {
|
|||||||
<TruncatedAddress>{truncated}</TruncatedAddress>
|
<TruncatedAddress>{truncated}</TruncatedAddress>
|
||||||
<Copy size={14} />
|
<Copy size={14} />
|
||||||
</CopyAddressRow>
|
</CopyAddressRow>
|
||||||
{isCopied && <ToolTip />}
|
{isCopied && <Tooltip isCopyContractTooltip={true} />}
|
||||||
</CopyContractAddressWrapper>
|
</CopyContractAddressWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user