Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Fixes WalletModal layout
Browse files Browse the repository at this point in the history
  • Loading branch information
YauheniDraichykau committed Aug 1, 2023
1 parent dacb3ba commit c649e68
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

&-coin-image {
margin-right: 10px;
width: 20px;
height: 20px;
}

&-value {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
@use '~styles/variables' as *;
@use '~styles/mixins' as *;

.list {
.list {
max-height: 430px;
overflow-y: auto;

.wallet-button {
width: 100%;
min-height: 48px;
Expand Down Expand Up @@ -45,6 +48,16 @@
.account {
display: flex;
align-items: center;
margin: 10px 0;

&-identicon {
display: inline;
}

&-name {
max-width: 200px;
white-space: nowrap;
}

&-button {
width: 100%;
Expand All @@ -60,9 +73,19 @@
color: theme-var($text-primary);
background-color: theme-var($background-primary);
transition: all 0.3s;
overflow-y: auto;
border: none;
outline: none;
cursor: pointer;

&-content {
width: 100%;
padding-left: 10px;
gap: 10px;
display: inline-flex;
justify-content: center;
align-items: center;
}

&.active {
background: theme-var($green-special);
Expand All @@ -72,6 +95,7 @@
background-color: theme-var($background-primary);
}
}

}

.footer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigate } from 'react-router-dom';
import Identicon from '@polkadot/react-identicon';
import { decodeAddress } from '@gear-js/api';
import { useAccount } from '@gear-js/react-hooks';
import { useAccount, useAlert } from '@gear-js/react-hooks';
import { Modal } from 'components';
import { cx, copyToClipboard } from '@/utils';
import copyToClipboardSVG from '@/assets/icons/binary-code.svg';
Expand All @@ -19,6 +19,7 @@ import { useAuth } from '@/features/Auth/hooks';

function WalletModal({ onClose }: WalletModalProps) {
const { extensions, account } = useAccount();
const alert = useAlert();
const { wallet, walletAccounts, setWalletId, resetWalletId, getWalletAccounts, saveWallet, removeWallet } =
useWallet();
const navigate = useNavigate();
Expand Down Expand Up @@ -62,7 +63,7 @@ function WalletModal({ onClose }: WalletModalProps) {
const handleCopyClick = () => {
const decodedAddress = decodeAddress(address);

copyToClipboard(decodedAddress);
copyToClipboard(decodedAddress).then(() => alert.success('copied'));
onClose();
};

Expand All @@ -73,8 +74,10 @@ function WalletModal({ onClose }: WalletModalProps) {
className={cx(styles['account-button'], isActive ? styles.active : '')}
onClick={handleClick}
disabled={isActive}>
<Identicon value={address} size={21} theme="polkadot" />
<span>{meta.name}</span>
<div className={cx(styles['account-button-content'])}>
<Identicon value={address} size={21} theme="polkadot" className={cx(styles['account-identicon'])} />
<span className={cx(styles['account-name'])}>{meta.name}</span>
</div>
</button>
<Button variant="icon" label="" icon={copyToClipboardSVG} onClick={handleCopyClick} />
</li>
Expand Down

0 comments on commit c649e68

Please sign in to comment.