-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from leapwallet/release-20240130-143717
Release release-20240130-143717
- Loading branch information
Showing
125 changed files
with
3,291 additions
and
1,037 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
apps/extension/src/components/custom-checkbox/CustomCheckbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Images } from 'images' | ||
import React from 'react' | ||
|
||
type CustomCheckboxProps = { | ||
checked: boolean | ||
color: string | ||
onClick: () => void | ||
} | ||
|
||
export function CustomCheckbox({ checked, color, onClick }: CustomCheckboxProps) { | ||
return ( | ||
<div | ||
className={`w-[20px] h-[20px] rounded border-[2px] border-${color}-400 cursor-pointer relative`} | ||
onClick={onClick} | ||
> | ||
<span className='w-[20px] block h-[20px]' /> | ||
{checked && ( | ||
<img src={Images.Misc.FilledRoundedSquareCheckMark} className='absolute inset-0' /> | ||
)} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './CustomCheckbox' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
apps/extension/src/components/eth-copy-wallet-address/EthCopyWalletAddress.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { ThemeName, useTheme } from '@leapwallet/leap-ui' | ||
import classNames from 'classnames' | ||
import { Images } from 'images' | ||
import React, { MouseEventHandler, useState } from 'react' | ||
|
||
type EthCopyWalletAddressProps = { | ||
readonly type?: 'button' | 'submit' | 'reset' | ||
readonly walletAddresses?: string[] | ||
readonly onCopy?: () => void | ||
readonly color: string | ||
readonly textOnCopied?: string | ||
readonly className?: string | ||
readonly copyIcon?: string | ||
readonly onTextClick?: () => void | ||
} | ||
|
||
export function EthCopyWalletAddress({ | ||
type, | ||
walletAddresses, | ||
color, | ||
onCopy, | ||
textOnCopied = 'Copied', | ||
copyIcon, | ||
className, | ||
onTextClick, | ||
...rest | ||
}: EthCopyWalletAddressProps) { | ||
const [copied, setCopied] = useState(false) | ||
|
||
const text = copied ? textOnCopied : walletAddresses?.[0] ?? '' | ||
const copyIconSrc: string = | ||
useTheme().theme === ThemeName.DARK ? Images.Misc.CopyGray200 : Images.Misc.CopyGray600 | ||
|
||
const handleClick: MouseEventHandler<HTMLDivElement | HTMLButtonElement> = async (event) => { | ||
onTextClick && event.stopPropagation() | ||
|
||
setCopied(true) | ||
setTimeout(() => setCopied(false), 2000) | ||
|
||
onCopy && (await onCopy()) | ||
} | ||
|
||
const handleTextClick: MouseEventHandler<HTMLDivElement> = (event) => { | ||
if (onTextClick) { | ||
event.stopPropagation() | ||
onTextClick() | ||
} | ||
} | ||
|
||
return ( | ||
<button | ||
style={copied ? { backgroundColor: color } : {}} | ||
className={classNames( | ||
'relative font-Satoshi14px text-[14px] leading-[20px] py-[8px] cursor-pointer', | ||
{ | ||
'text-white-100 font-bold rounded-[56px] pl-[21px] pr-[25px]': copied, | ||
'text-gray-600 dark:text-gray-200 bg-white-100 dark:bg-gray-900 rounded-[30px] pl-4 pr-3': | ||
!copied, | ||
}, | ||
className, | ||
)} | ||
onClick={onTextClick ? undefined : handleClick} | ||
type={type ?? 'button'} | ||
{...rest} | ||
> | ||
<div className='flex justify-center items-center'> | ||
{copied && ( | ||
<div className='block'> | ||
<Images.Misc.CopiedSvg fill='white' height='18' width='18' /> | ||
</div> | ||
)} | ||
|
||
<div | ||
className={classNames('block', { 'mr-[10.33px]': !copied, 'ml-[5.67px]': copied })} | ||
onClick={handleTextClick} | ||
> | ||
{text} | ||
|
||
{(walletAddresses?.length ?? 1) > 1 && !copied ? ( | ||
<span className='ml-[5px] -mr-[5px] bg-gray-100 dark:bg-gray-800 text-[12px] py-[3px] px-[5px] rounded-full'> | ||
+{(walletAddresses?.length ?? 1) - 1} | ||
</span> | ||
) : null} | ||
</div> | ||
|
||
{!copied && ( | ||
<div className='block' onClick={onTextClick ? handleClick : undefined}> | ||
<img alt='Copy' src={copyIcon ?? copyIconSrc} /> | ||
</div> | ||
)} | ||
</div> | ||
</button> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './EthCopyWalletAddress' |
Oops, something went wrong.