Skip to content

Commit

Permalink
use isMobile to conditionally render info
Browse files Browse the repository at this point in the history
  • Loading branch information
G9000 committed Oct 23, 2023
1 parent e54b227 commit 485c22e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface WalletButtonProp {
icon: string;
setErrorMessage: (msg: string) => void;
isDisabled?: boolean;
isMobileDevice?: boolean;
}

export function WalletButton({

Check warning on line 15 in packages/ord-connect/src/components/SelectWalletModal/WalletButton.tsx

View workflow job for this annotation

GitHub Actions / Lint - Typescript and ESLint

Prefer default export on a file with single export
Expand All @@ -18,6 +19,7 @@ export function WalletButton({
icon,
setErrorMessage,
isDisabled,
isMobileDevice,
}: WalletButtonProp) {
const [loading, setLoading] = useState(false);
return (
Expand All @@ -41,7 +43,12 @@ export function WalletButton({
<img width={32} src={icon} alt={`Connect ${name} Wallet`} />

Check warning on line 43 in packages/ord-connect/src/components/SelectWalletModal/WalletButton.tsx

View workflow job for this annotation

GitHub Actions / Lint - Typescript and ESLint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
<div className="wallet-option">
<span className="wallet-option-label">{name}</span>
<span className="wallet-option-info">{info}</span>
<span
className="wallet-option-info"
style={{ display: isMobileDevice ? "block" : "none" }}
>
{info}
</span>
</div>
{loading ? (
<img

Check warning on line 54 in packages/ord-connect/src/components/SelectWalletModal/WalletButton.tsx

View workflow job for this annotation

GitHub Actions / Lint - Typescript and ESLint

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export function SelectWalletModal({
icon={UnisatWalletIcon}
setErrorMessage={setErrorMessage}
isDisabled={isMobileDevice()}
isMobileDevice={isMobileDevice()}
/>
<hr className="horizontal-separator" />
<WalletButton
Expand All @@ -206,6 +207,7 @@ export function SelectWalletModal({
onConnect={onConnectXverseWallet}
icon={XverseWalletIcon}
setErrorMessage={setErrorMessage}
isMobileDevice={isMobileDevice()}
/>
</section>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,12 @@
}

.ord-connect-wallet-modal .wallet-option-info {
display: block;
font-size: 12px;
font-weight: 400;
line-height: 16px;
color: #8c8c8c;
}

@media (min-width: 768px) {
.ord-connect-wallet-modal .wallet-option-info {
display: none;
}
}

.ord-connect-wallet-modal .horizontal-separator {
margin: 0px 16px;
border: 0px;
Expand Down

0 comments on commit 485c22e

Please sign in to comment.