Skip to content

Commit

Permalink
Improve connect button styles
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed Jul 1, 2024
1 parent 4a5cb0d commit 2de7e8e
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 12 deletions.
103 changes: 95 additions & 8 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"sats-connect": "file:..",
"styled-components": "6.1.11",
"typescript": "^4.9.5"
},
"eslintConfig": {
Expand Down
7 changes: 7 additions & 0 deletions example/src/App.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styled from 'styled-components';

export const ConnectButtonsContainer = styled.div({
display: 'flex',
flexDirection: 'column',
gap: '0.5rem',
});
11 changes: 7 additions & 4 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useLocalStorage } from './hooks';
import { useCallback, useState } from 'react';
import GetBtcBalance from './components/GetBtcBalance';
import GetRunesBalance from './components/GetRunesBalance';
import { ConnectButtonsContainer } from './App.styles';

function App() {
const [network, setNetwork] = useLocalStorage<BitcoinNetworkType>(
Expand All @@ -22,7 +23,7 @@ function App() {

const isConnected = addressInfo.length > 0;

const onConnect = async () => {
const onConnectLegacy = async () => {
const response = await Wallet.request('getAccounts', {
purposes: [AddressPurpose.Payment, AddressPurpose.Ordinals, AddressPurpose.Stacks],
message: 'Cool app wants to know your addresses!',
Expand All @@ -32,7 +33,7 @@ function App() {
}
};

const onConnect2 = useCallback(async () => {
const onConnect = useCallback(async () => {
const res = await Wallet.request('wallet_requestPermissions', undefined);
if (res.status === 'error') {
console.error('Error connecting to wallet, details in terminal.');
Expand Down Expand Up @@ -76,8 +77,10 @@ function App() {
<img className="logo" src="/sats-connect.svg" alt="SatsConnect" />
<NetworkSelector network={network} setNetwork={setNetwork} />
<p>Click the button to connect your wallet</p>
<button onClick={onConnect}>Connect</button>
<button onClick={onConnect2}>Connect2</button>
<ConnectButtonsContainer>
<button onClick={onConnect}>Connect</button>
<button onClick={onConnectLegacy}>Connect (Legacy)</button>
</ConnectButtonsContainer>
</header>
</div>
);
Expand Down

0 comments on commit 2de7e8e

Please sign in to comment.