Skip to content

Commit

Permalink
refactor: connect button and add some icons (#33)
Browse files Browse the repository at this point in the history
* chore: format icons svg to react component

* feat(icons): fomat icons in svg

* ci(icons): fix ci issue by add an alias

* chore(icons): ci issues

* feat(common): add chains config

* feat(icons): more filled icons

* refactor(web3): connect button

* refactor(web3): connect button

* ci(web3): fix ci issues
  • Loading branch information
jeasonstudio authored Oct 11, 2023
1 parent 9d19d24 commit 61df44d
Show file tree
Hide file tree
Showing 38 changed files with 472 additions and 196 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"conventionalCommits.scopes": ["workspace", "web3", "icons"]
"conventionalCommits.scopes": ["workspace", "web3", "icons", "common"]
}
31 changes: 31 additions & 0 deletions packages/common/src/chains.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { Chain } from './types';

export const mainnet: Chain = {
id: 1,
name: 'Ethereum',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
};

export const polygon: Chain = {
id: 137,
name: 'Polygon',
nativeCurrency: { name: 'MATIC', symbol: 'MATIC', decimals: 18 },
};

export const bsc: Chain = {
id: 56,
name: 'BNB Smart Chain',
nativeCurrency: { decimals: 18, name: 'BNB', symbol: 'BNB' },
};

export const arbitrum: Chain = {
id: 42_161,
name: 'Arbitrum One',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
};

export const optimism: Chain = {
id: 10,
name: 'OP Mainnet',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
};
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './types';
export * as chains from './chains';
export * from './wallets/index';
export * from './providers';
export * from './utils';
14 changes: 13 additions & 1 deletion packages/common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ export enum Chains {
bitcoin = 'bitcoin:',
}

export interface Chain {
id: number;
name: string;
rpcHttpUrl?: string;
blockExplorerUrl?: string;
nativeCurrency?: {
decimals: number;
name: string;
symbol: string;
};
}

export enum Wallets {
MetaMask = 'MetaMask',
WalletConnect = 'WalletConnect',
Expand Down Expand Up @@ -50,5 +62,5 @@ export interface WalletProviderFactory {
}

export interface JsonRpcProvider {
getRpcUrl(chain: Chains): string;
getRpcUrl: (chain: Chains) => string;
}
9 changes: 9 additions & 0 deletions packages/icons/src/components/arbitrum-filled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';
import AntdIcon from '@ant-design/icons';
import { ReactComponent as SVGComponent } from '../svgs/arbitrum-filled.svg';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

export const ArbitrumFilled = React.forwardRef<HTMLSpanElement, IconBaseProps>((props, ref) => (
<AntdIcon {...props} ref={ref} component={SVGComponent} />
));
ArbitrumFilled.displayName = 'ArbitrumFilled';
9 changes: 9 additions & 0 deletions packages/icons/src/components/bitcoin-filled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';
import AntdIcon from '@ant-design/icons';
import { ReactComponent as SVGComponent } from '../svgs/bitcoin-filled.svg';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

export const BitcoinFilled = React.forwardRef<HTMLSpanElement, IconBaseProps>((props, ref) => (
<AntdIcon {...props} ref={ref} component={SVGComponent} />
));
BitcoinFilled.displayName = 'BitcoinFilled';
9 changes: 9 additions & 0 deletions packages/icons/src/components/bsc-filled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';
import AntdIcon from '@ant-design/icons';
import { ReactComponent as SVGComponent } from '../svgs/bsc-filled.svg';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

export const BSCFilled = React.forwardRef<HTMLSpanElement, IconBaseProps>((props, ref) => (
<AntdIcon {...props} ref={ref} component={SVGComponent} />
));
BSCFilled.displayName = 'BSCFilled';
9 changes: 9 additions & 0 deletions packages/icons/src/components/ethereum-filled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';
import AntdIcon from '@ant-design/icons';
import { ReactComponent as SVGComponent } from '../svgs/ethereum-filled.svg';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

export const EthereumFilled = React.forwardRef<HTMLSpanElement, IconBaseProps>((props, ref) => (
<AntdIcon {...props} ref={ref} component={SVGComponent} />
));
EthereumFilled.displayName = 'EthereumFilled';
9 changes: 9 additions & 0 deletions packages/icons/src/components/optimism-filled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';
import AntdIcon from '@ant-design/icons';
import { ReactComponent as SVGComponent } from '../svgs/optimism-filled.svg';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

export const OptimismFilled = React.forwardRef<HTMLSpanElement, IconBaseProps>((props, ref) => (
<AntdIcon {...props} ref={ref} component={SVGComponent} />
));
OptimismFilled.displayName = 'OptimismFilled';
9 changes: 9 additions & 0 deletions packages/icons/src/components/polygon-filled.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as React from 'react';
import AntdIcon from '@ant-design/icons';
import { ReactComponent as SVGComponent } from '../svgs/polygon-filled.svg';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

export const PolygonFilled = React.forwardRef<HTMLSpanElement, IconBaseProps>((props, ref) => (
<AntdIcon {...props} ref={ref} component={SVGComponent} />
));
PolygonFilled.displayName = 'PolygonFilled';
6 changes: 6 additions & 0 deletions packages/icons/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
export * from './components/arbitrum-filled';
export * from './components/bitcoin-filled';
export * from './components/bitcoin';
export * from './components/bsc-filled';
export * from './components/ethereum-filled';
export * from './components/ethereum';
export * from './components/optimism-filled';
export * from './components/polygon-filled';
export * from './components/usdt';
export * from './components/wallet';

Expand Down
9 changes: 9 additions & 0 deletions packages/icons/src/svgs/arbitrum-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/icons/src/svgs/bitcoin-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions packages/icons/src/svgs/bsc-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions packages/icons/src/svgs/ethereum-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/icons/src/svgs/optimism-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/icons/src/svgs/polygon-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/icons/src/svgs/wallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions packages/web3/src/ConnectButton/demos/complex.tsx

This file was deleted.

64 changes: 0 additions & 64 deletions packages/web3/src/ConnectButton/index.tsx

This file was deleted.

Loading

0 comments on commit 61df44d

Please sign in to comment.