Skip to content

Commit 382823c

Browse files
committed
feat: more headers,
feat: added homescreen tabs, feat: added modal border
1 parent 93c059f commit 382823c

File tree

21 files changed

+233
-52
lines changed

21 files changed

+233
-52
lines changed

packages/connect/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ export {
4444

4545
// Utils
4646
export { getConnectWallets } from './utils/getConnectWallets.js'
47-
export { capitalize, compareAddress, formatAddress, formatDisplay, isEmailValid, truncateAtMiddle } from './utils/helpers.js'
47+
export {
48+
capitalize,
49+
compareAddress,
50+
formatAddress,
51+
formatDisplay,
52+
isEmailValid,
53+
truncateAtIndex,
54+
truncateAtMiddle
55+
} from './utils/helpers.js'
4856
export { createNativeTokenBalance, getNativeTokenInfoByChainId } from './utils/tokens.js'
4957
export { getModalPositionCss } from './utils/styling.js'
5058
export { getNetwork, getNetworkBackgroundColor, getNetworkColor } from './utils/networks.js'

packages/connect/src/styles.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ export const styles = String.raw`
241241
.left-4 {
242242
left: calc(var(--spacing) * 4);
243243
}
244+
.left-\[-16px\] {
245+
left: -16px;
246+
}
244247
.z-1 {
245248
z-index: 1;
246249
}
@@ -433,6 +436,9 @@ export const styles = String.raw`
433436
.h-\[1px\] {
434437
height: 1px;
435438
}
439+
.h-\[2px\] {
440+
height: 2px;
441+
}
436442
.h-\[52px\] {
437443
height: 52px;
438444
}

packages/connect/src/utils/helpers.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ export const truncateAtMiddle = (text: string, truncateAt: number) => {
107107
return finalText
108108
}
109109

110+
export const truncateAtIndex = (text: string, truncateIndex: number) => {
111+
let finalText = text
112+
113+
if (text.length >= truncateIndex) {
114+
finalText = text.slice(0, truncateIndex) + '...' + text.slice(text.length - 4, text.length)
115+
}
116+
117+
return finalText
118+
}
119+
110120
export const formatAddress = (text: string) => {
111121
return `0x${truncateAtMiddle(text?.substring(2) || '', 8)}`
112122
}

packages/wallet-widget/src/components/Filter/WalletsFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const WalletsFilter = () => {
5050
}
5151
onClick={() => setSelectedWallets([wallet])}
5252
>
53-
<WalletAccountGradient accountAddress={wallet.address} size={'small'} />
53+
<WalletAccountGradient accountAddress={wallet.address} />
5454
<Text className="flex flex-row gap-1 items-center" nowrap color="primary" fontWeight="medium" variant="normal">
5555
{formatAddress(wallet.address)}
5656
<CopyButton text={wallet.address} buttonVariant="icon" onClick={e => e.stopPropagation()} />
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Image, Text } from '@0xsequence/design-system'
2+
3+
export const Collectible = ({ imgSrc, imgLabel }: { imgSrc?: string; imgLabel?: string }) => {
4+
return (
5+
<div className="flex flex-row items-center h-full w-full">
6+
<div className="px-3">
7+
<Image
8+
className="w-9 h-9"
9+
src={imgSrc}
10+
alt={imgLabel}
11+
style={{
12+
objectFit: 'cover'
13+
}}
14+
/>
15+
</div>
16+
<div className="flex flex-col">
17+
<Text variant="medium" color="text100">
18+
{imgLabel}
19+
</Text>
20+
</div>
21+
</div>
22+
)
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Image, Text } from '@0xsequence/design-system'
2+
3+
export const Collection = ({ imgSrc, imgLabel }: { imgSrc?: string; imgLabel?: string }) => {
4+
return (
5+
<div className="flex flex-row items-center h-full w-full">
6+
<div className="px-3">
7+
<Image
8+
className="w-9 h-9"
9+
src={imgSrc}
10+
alt={imgLabel}
11+
style={{
12+
objectFit: 'cover'
13+
}}
14+
/>
15+
</div>
16+
<div className="flex flex-col">
17+
<Text variant="medium" color="text100">
18+
{imgLabel}
19+
</Text>
20+
</div>
21+
</div>
22+
)
23+
}

packages/wallet-widget/src/components/NavigationHeader/content/home.tsx renamed to packages/wallet-widget/src/components/NavigationHeader/content/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const Home = () => {
99
<IconButton className="bg-background-secondary" icon={SearchIcon} size="sm" />
1010
<IconButton className="bg-background-secondary" icon={SettingsIcon} size="sm" />
1111
</div>
12-
<Divider className="my-0 w-full" />
12+
<Divider className="my-0 w-full" style={{ position: 'absolute', bottom: 0 }} />
1313
</div>
1414
)
1515
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { TextInput } from '@0xsequence/design-system'
2+
3+
export const Search = () => {
4+
return (
5+
<div className="grow px-4">
6+
<TextInput autoFocus placeholder="Search" name={'Search Wallet'} />
7+
</div>
8+
)
9+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// import { Text } from '@0xsequence/design-system'
2+
3+
// export const Settings = () => {
4+
// return (
5+
// <div className="flex flex-row justify-center items-center p-4 gap-3 w-full">
6+
// <Text variant="medium" color="text100">
7+
// Settings
8+
// </Text>
9+
// </div>
10+
// )
11+
// }
12+
import { Text } from '@0xsequence/design-system'
13+
14+
export const Settings = () => {
15+
return (
16+
<div className="flex flex-col justify-center items-center">
17+
<Text variant="medium" color="text100">
18+
Settings
19+
</Text>
20+
</div>
21+
)
22+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const Token = () => {
2+
return <div></div>
3+
}

packages/wallet-widget/src/components/NavigationHeader/content/collectible.tsx

Whitespace-only changes.

packages/wallet-widget/src/components/NavigationHeader/content/collection.tsx

Whitespace-only changes.

packages/wallet-widget/src/components/NavigationHeader/content/search.tsx

Whitespace-only changes.

packages/wallet-widget/src/components/NavigationHeader/content/settings.tsx

Whitespace-only changes.

packages/wallet-widget/src/components/NavigationHeader/content/token.tsx

Whitespace-only changes.

packages/wallet-widget/src/components/NavigationHeader/index.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import { HEADER_HEIGHT } from '../../constants/index.js'
44
import { useNavigationContext } from '../../contexts/Navigation.js'
55
import { useNavigation } from '../../hooks/index.js'
66

7-
import { Home } from './content/home.js'
7+
import { Collectible } from './content/Collectible.js'
8+
import { Collection } from './content/Collection.js'
9+
import { Home } from './content/Home.js'
10+
import { Search } from './content/Search.js'
11+
import { Settings } from './content/Settings.js'
12+
import { Token } from './content/Token.js'
813

914
interface NavigationHeaderProps {
1015
type: 'home' | 'search' | 'settings' | 'token' | 'collectible' | 'collection'
@@ -17,15 +22,15 @@ const getHeaderContent = (type: NavigationHeaderProps['type'], imgSrc?: string,
1722
case 'home':
1823
return <Home />
1924
case 'search':
20-
return <div />
25+
return <Search />
2126
case 'settings':
22-
return <div />
27+
return <Settings />
2328
case 'token':
24-
return <div />
29+
return <Token /> // TODO: add imgSrc and imgLabel?
2530
case 'collectible':
26-
return <div />
31+
return <Collectible imgSrc={imgSrc} imgLabel={imgLabel} />
2732
case 'collection':
28-
return <div />
33+
return <Collection imgSrc={imgSrc} imgLabel={imgLabel} />
2934
}
3035
}
3136

@@ -46,17 +51,17 @@ export const NavigationHeader = ({ type, imgSrc, imgLabel }: NavigationHeaderPro
4651
<IconButton
4752
onClick={onClickBack}
4853
icon={ChevronLeftIcon}
49-
size="xs"
54+
size="sm"
5055
disabled={!isBackButtonEnabled}
51-
style={{ opacity: isBackButtonEnabled ? 1 : 0.5 }}
56+
style={{ opacity: isBackButtonEnabled ? 1 : 0.5, marginLeft: '16px' }}
5257
/>
5358
) : (
5459
<div />
5560
)}
5661

5762
{getHeaderContent(type, imgSrc, imgLabel)}
5863

59-
{/* <div style={{ width: '28px' }} /> */}
64+
{type !== 'search' && history.length > 0 ? <div style={{ width: '52px' }} /> : <div />}
6065
</div>
6166
)
6267
}

packages/wallet-widget/src/components/Select/SelectWalletRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const SelectWalletRow = ({
3838
onClick={onSelectWallet}
3939
isSelected={wallet.isActive || isSelected}
4040
>
41-
<WalletAccountGradient accountAddress={wallet.address} size={'small'} />
41+
<WalletAccountGradient accountAddress={wallet.address} />
4242
<div className="flex flex-col">
4343
<Text className="flex flex-row gap-1 items-center" nowrap color="primary" fontWeight="medium" variant="normal">
4444
{formatAddress(wallet.address)}

packages/wallet-widget/src/components/SequenceWalletProvider/SequenceWalletProvider.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const WalletContent = ({ children }: SequenceWalletProviderProps) => {
9696
{openWalletModal && !isAddFundsModalOpen && !isConnectModalOpen && (
9797
<Modal
9898
contentProps={{
99+
className: 'border border-border-normal',
99100
style: {
100101
maxWidth: WALLET_WIDTH,
101102
height: 'fit-content',
@@ -107,14 +108,10 @@ export const WalletContent = ({ children }: SequenceWalletProviderProps) => {
107108
scroll={false}
108109
onClose={() => setOpenWalletModal(false)}
109110
>
110-
<div id="sequence-kit-wallet-content" ref={walletContentRef}>
111+
<div id="sequence-kit-wallet-content" ref={walletContentRef} style={{ height: WALLET_HEIGHT }}>
111112
{getHeader(navigation)}
112113

113-
{displayScrollbar ? (
114-
<Scroll style={{ height: WALLET_HEIGHT }}>{getContent(navigation)}</Scroll>
115-
) : (
116-
getContent(navigation)
117-
)}
114+
{displayScrollbar ? <Scroll>{getContent(navigation)}</Scroll> : getContent(navigation)}
118115
</div>
119116
</Modal>
120117
)}

packages/wallet-widget/src/components/WalletAccountGradient.tsx

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,30 @@ import { GradientAvatar } from '@0xsequence/design-system'
33

44
import { getConnectorLogo } from './ConnectorLogos/getConnectorLogos.js'
55

6-
export const WalletAccountGradient = ({
7-
accountAddress,
8-
size = 'large'
9-
}: {
10-
accountAddress: string
11-
size?: 'small' | 'large'
12-
}) => {
6+
export const WalletAccountGradient = ({ accountAddress }: { accountAddress: string }) => {
137
const { wallets } = useWallets()
14-
const remSize = size === 'small' ? 8 : 16
158

169
const LoginIcon = getConnectorLogo(wallets.find(wallet => wallet.address === accountAddress)?.signInMethod || '')
1710

1811
return (
1912
<div className="flex relative">
2013
<div className="relative inline-block">
21-
<GradientAvatar className={`w-${remSize} h-${remSize}`} size="xl" address={accountAddress || ''} />
14+
<GradientAvatar className="w-11 h-11" size="xl" address={accountAddress || ''} />
2215
<div
2316
style={{
2417
position: 'absolute',
25-
bottom: `-${remSize / 4}px`,
26-
right: `-${remSize / 4}px`,
27-
border: `${remSize / 8}px solid black`,
28-
backgroundColor: 'lightgrey',
18+
bottom: 0,
19+
right: 0,
20+
backgroundColor: 'black',
2921
borderRadius: '50%',
3022
display: 'flex',
3123
justifyContent: 'center',
3224
alignItems: 'center',
33-
padding: `${remSize / 4}px`
25+
height: '20px',
26+
width: '20px'
3427
}}
3528
>
36-
<div style={{ width: remSize, height: remSize }}>{LoginIcon}</div>
29+
<div style={{ width: '14px', height: '14px' }}>{LoginIcon}</div>
3730
</div>
3831
</div>
3932
</div>

0 commit comments

Comments
 (0)