Skip to content

Commit a86f632

Browse files
committed
Show wallet connector in control bar
Minor style improvements
1 parent 8ac3088 commit a86f632

File tree

6 files changed

+33
-15
lines changed

6 files changed

+33
-15
lines changed

src/components/buttons/SolidButton.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ interface ButtonProps {
44
size?: 'xs' | 's' | 'm' | 'l' | 'xl';
55
type?: 'submit' | 'reset' | 'button';
66
onClick?: () => void;
7-
color?: 'white' | 'green' | 'red'; // defaults to green
7+
color?: 'white' | 'beige' | 'green' | 'red'; // defaults to green
88
classes?: string;
99
bold?: boolean;
1010
disabled?: boolean;
@@ -26,13 +26,17 @@ export function SolidButton(props: PropsWithChildren<ButtonProps>) {
2626
title,
2727
passThruProps,
2828
} = props;
29-
const color = _color ?? 'green';
29+
const color = _color ?? 'beige';
3030

3131
const base =
3232
'flex items-center justify-center rounded-full transition-all duration-300';
3333
const sizing = sizeToClasses(size);
3434
let baseColors, onHover, onActive;
35-
if (color === 'green') {
35+
if (color === 'beige') {
36+
baseColors = 'bg-beige-600 text-gray-700';
37+
onHover = 'hover:bg-beige-500';
38+
onActive = 'active:bg-beige-400';
39+
} else if (color === 'green') {
3640
baseColors = 'bg-green-500 text-white';
3741
onHover = 'hover:bg-green-600';
3842
onActive = 'active:bg-green-700';

src/components/layout/AppLayout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function AppLayout({ pathName, children }: PropsWithChildren<Props>) {
1717
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1818
<title>{`Abacus Nft Example App | ${getHeadTitle(pathName)}`}</title>
1919
</Head>
20-
<div className="flex flex-col justify-between h-full min-h-screen w-full min-w-screen bg-beige">
20+
<div className="flex flex-col justify-between h-full min-h-screen w-full min-w-screen bg-beige-500">
2121
<Header />
2222
<main className="w-full">{children}</main>
2323
<Footer />

src/components/nav/Header.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export function Header() {
1515
src={Logo}
1616
alt="Abacus Logo"
1717
quality={100}
18-
width={180}
19-
height={80}
18+
width={170}
19+
height={50}
2020
/>
2121
</div>
2222
</a>

src/features/wallet/WalletControlBar.tsx

+10-6
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ export function WalletControlBar() {
3737
}
3838

3939
function AccountDropdown() {
40-
const { address, isConnected } = useAccount();
40+
const { address, isConnected, connector } = useAccount();
4141
const { connectAsync, connectors } = useConnect();
4242
const { disconnectAsync } = useDisconnect();
43+
const isAccountReady = address && isConnected && connector;
4344

4445
const { buttonProps, itemProps, isOpen, setIsOpen } = useDropdownMenu(2);
4546

@@ -76,10 +77,13 @@ function AccountDropdown() {
7677

7778
return (
7879
<div className="relative">
79-
{address && isConnected ? (
80+
{isAccountReady ? (
8081
<button className={styles.dropdownButton} {...buttonProps}>
8182
<Identicon address={address} size={30} />
82-
<div className="mx-2 text-sm">{shortenAddress(address, true)}</div>
83+
<div className="flex flex-col mx-3 items-start">
84+
<div className="text-xs">{connector.name}</div>
85+
<div className="text-xs">{shortenAddress(address, true)}</div>
86+
</div>
8387
<Icon src={ChevronDown} alt="Down Arrow" size={14} />
8488
</button>
8589
) : (
@@ -129,15 +133,15 @@ function ChainDropdown() {
129133
await switchNetworkAsync(targetChainId);
130134
} catch (error) {
131135
logger.error('Error switching network', error);
132-
toast.error('Could not switching network');
136+
toast.error('Could not switch network');
133137
}
134138
};
135139

136140
return (
137141
<div className="relative">
138142
<button className={styles.dropdownButton} {...buttonProps}>
139-
<Icon src={Cube} alt="Network" />
140-
<div className="mx-2">{chain?.name || 'Unknown'}</div>
143+
<Icon src={Cube} alt="Network" size={16} />
144+
<div className="mx-2">{chain?.name || 'None'}</div>
141145
<Icon src={ChevronDown} alt="Down Arrow" size={14} />
142146
</button>
143147

src/pages/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Home: NextPage = () => {
99
const [page, setPage] = useState<'search' | 'transfer'>('search');
1010
return (
1111
<div className="flex flex-col justify-center items-center h-full">
12-
<div className="w-128 px-4 pt-2 pb-1 bg-red-400 rounded-t-lg">
12+
<div className="w-112 px-4 pt-2 pb-1 bg-red-400 rounded-t-lg">
1313
<h1 className="text-gray-50 text-center">Abacus Example Nft App</h1>
1414
<div className="flex justify-center mt-3 space-x-20">
1515
<PageNavButton
@@ -26,7 +26,7 @@ const Home: NextPage = () => {
2626
</PageNavButton>
2727
</div>
2828
</div>
29-
<FloatingBox width="w-128" classes="relative -top-1">
29+
<FloatingBox width="w-112" classes="relative -top-1">
3030
{page === 'search' && <SearchForm />}
3131
{page === 'transfer' && <TransferForm />}
3232
</FloatingBox>

tailwind.config.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ module.exports = {
1616
colors: {
1717
black: '#010101',
1818
white: '#ffffff',
19-
beige: '#F1EDE9',
19+
beige: {
20+
100: '#F6F4F1',
21+
200: '#F5F2EF',
22+
300: '#F3F0ED',
23+
400: '#F2EEEB',
24+
500: '#F1EDE9',
25+
600: '#D8D5D1',
26+
700: '#C0BDBA',
27+
800: '#A8A5A3',
28+
900: '#908E8B',
29+
},
2030
red: {
2131
100: '#F28B84',
2232
200: '#F07770',

0 commit comments

Comments
 (0)