Skip to content

Commit

Permalink
Create WalletContent.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 24, 2024
1 parent 9baa163 commit 2a7c125
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions app/components/WalletContent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React, { useState, useEffect } from 'react';
import { useWallet } from '../contexts/WalletContext';
import { useTheme } from '../contexts/ThemeContext';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPlus, faMinus } from '@fortawesome/free-solid-svg-icons';
import WalletOverview from './WalletOverview';
import WalletAccounts from './WalletAccounts';
import WalletTransactions from './WalletTransactions';

const WalletContent = () => {
const [selectedTab, setSelectedTab] = useState('overview');
const { wallet, accounts } = useWallet();
const { theme } = useTheme();

useEffect(() => {
wallet.getWalletData();
}, []);

const handleTabSelect = (tab) => {
setSelectedTab(tab);
};

return (
<main className={`wallet-content ${theme}`}>
<div className="wallet-content-tabs">
<button
className={`wallet-content-tab ${selectedTab === 'overview' ? 'active' : ''}`}
onClick={() => handleTabSelect('overview')}
>
<FontAwesomeIcon icon={faPlus} size="lg" />
<span>Overview</span>
</button>
<button
className={`wallet-content-tab ${selectedTab === 'transactions' ? 'active' : ''}`}
onClick={() => handleTabSelect('transactions')}
>
<FontAwesomeIcon icon={faGear} size="lg" />
<span>Transactions</span>
</button>
</div>
{selectedTab === 'overview' && <WalletOverview />}
{selectedTab === 'accounts' && <WalletAccounts />}
{selectedTab === 'transactions' && <WalletTransactions />}
</main>
);
};

export default WalletContent;

0 comments on commit 2a7c125

Please sign in to comment.