Skip to content

Commit

Permalink
style: Tweak external link style.
Browse files Browse the repository at this point in the history
  • Loading branch information
kovipu committed Feb 5, 2025
1 parent 561f248 commit 2da6ff6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/components/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GoLinkExternal } from 'react-icons/go';
import { MdOutlineArrowOutward } from 'react-icons/md';

export interface LinkProps {
className?: string;
Expand All @@ -9,9 +9,9 @@ export interface LinkProps {
export const StellarExpertLink = ({ className = '', text = 'View contract', contractId }: LinkProps) => {
const href = `https://stellar.expert/explorer/testnet/contract/${contractId}`;
return (
<a className={`link flex flex-row ${className}`} href={href} target="_blank" rel="noreferrer">
<a className={`link flex flex-row hover:text-grey transition ${className}`} href={href} target="_blank" rel="noreferrer">
{text}
<GoLinkExternal className="ml-1 mt-1" size=".9rem" />
<MdOutlineArrowOutward className="mt-1" size=".9rem" />
</a>
);
};
17 changes: 6 additions & 11 deletions src/pages/_borrow/BorrowModal/BorrowModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export interface BorrowModalProps {
}

export const BorrowModal = ({ modalId, onClose, currency }: BorrowModalProps) => {
const { walletBalances, refetchBalances } = useWallet();
const { walletBalances } = useWallet();
// state to keep the user in the trustline step until they click ok.
const [isSettingTrustline, setIsSettingTrustline] = useState(false);

if (!currency) {
// Return an empty dialog if no currency set to make displaying the modal still work.
Expand All @@ -21,13 +23,6 @@ export const BorrowModal = ({ modalId, onClose, currency }: BorrowModalProps) =>

const { ticker } = currency;
const isTrustline = walletBalances?.[ticker].trustLine;
// state to keep the user in the trustline step until they click ok.
const [isSettingTrustline, setIsSettingTrustline] = useState(false);

const closeModal = () => {
refetchBalances();
onClose();
};

const handleAddTrustline = () => {
setIsSettingTrustline(true);
Expand All @@ -38,16 +33,16 @@ export const BorrowModal = ({ modalId, onClose, currency }: BorrowModalProps) =>
};

return (
<Dialog modalId={modalId} onClose={closeModal}>
<Dialog modalId={modalId} onClose={onClose}>
{!isTrustline || isSettingTrustline ? (
<TrustLineStep
onClose={closeModal}
onClose={onClose}
currency={currency}
onAddTrustline={handleAddTrustline}
onTrustlineAdded={handleTrustlineAdded}
/>
) : (
<BorrowStep onClose={closeModal} currency={currency} />
<BorrowStep onClose={onClose} currency={currency} />
)}
</Dialog>
);
Expand Down
6 changes: 6 additions & 0 deletions src/pages/_borrow/BorrowPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Card } from '@components/Card';
import { StellarExpertLink } from '@components/Link';
import { Table } from '@components/Table';
import WalletCard from '@components/WalletCard/WalletCard';
import { usePools } from '@contexts/pool-context';
import { useWallet } from '@contexts/wallet-context';
import { contractId } from '@contracts/loan_manager';
import { CURRENCY_BINDINGS_ARR, type CurrencyBinding } from 'src/currency-bindings';
import { BorrowModal } from './BorrowModal/BorrowModal';
Expand All @@ -15,6 +17,8 @@ const links = [
];

const BorrowPage = () => {
const { refetchBalances } = useWallet();
const { refetchPools } = usePools();
const [selectedCurrency, setSelectedCurrency] = useState<CurrencyBinding | null>(null);

const modalId = 'borrow-modal';
Expand All @@ -29,6 +33,8 @@ const BorrowPage = () => {
const modalEl = document.getElementById(modalId) as HTMLDialogElement;
modalEl.close();
setSelectedCurrency(null);
refetchBalances();
refetchPools();
};

return (
Expand Down

0 comments on commit 2da6ff6

Please sign in to comment.