-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
197 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
packages/wallet/src/shared/HomeHeader/components/AccountInformation.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { forwardRef } from 'react' | ||
|
||
import { | ||
Box, | ||
IconButton, | ||
Text, | ||
GradientAvatar, | ||
SearchIcon, | ||
ChevronDownIcon, | ||
vars, | ||
} from '@0xsequence/design-system' | ||
|
||
import { useAccount } from 'wagmi' | ||
|
||
import { formatAddress } from '../../../utils' | ||
import * as styles from '../../styles.css' | ||
|
||
interface AccountInformationProps { | ||
onClickAccount: () => void | ||
} | ||
|
||
export const AccountInformation = forwardRef(({ | ||
onClickAccount, | ||
}: AccountInformationProps, ref) => { | ||
const { address } = useAccount() | ||
|
||
|
||
return ( | ||
<Box gap="2" alignItems="center" style={{ height: "60px"}}> | ||
<Box width="full" flexDirection="column" alignItems="center" justifyContent="center" > | ||
<Box | ||
onClick={onClickAccount} | ||
gap="2" | ||
alignItems="center" | ||
justifyContent="center" | ||
className={styles.clickable} | ||
position="relative" | ||
style={{ | ||
left: '-22px' | ||
}} | ||
// @ts-ignore-next-line | ||
ref={ref} | ||
> | ||
<GradientAvatar size="sm" address={address || ''} /> | ||
<Text color="text100" fontWeight="medium" variant="normal"> | ||
{formatAddress(address || '')} | ||
</Text> | ||
<ChevronDownIcon /> | ||
</Box> | ||
</Box> | ||
</Box> | ||
) | ||
}) |
27 changes: 27 additions & 0 deletions
27
packages/wallet/src/shared/HomeHeader/components/WalletDropdownContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React, { forwardRef } from 'react' | ||
import { Box, Button } from '@0xsequence/design-system' | ||
|
||
export const WalletDropdownContent = () => { | ||
|
||
// Todo add forward ref and fix animation | ||
|
||
return ( | ||
<Box | ||
zIndex="30" | ||
background="buttonGlass" | ||
borderRadius="md" | ||
style={{ | ||
position: 'relative', | ||
pointerEvents: 'auto', | ||
width: '370px', | ||
height: '400px', | ||
backdropFilter: 'blur(12.5px)', | ||
top: '16px', | ||
left: '16px', | ||
}} | ||
> | ||
stuff goes here... | ||
<Button label="click" onClick={() => console.log('click')} /> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { useState, useRef, useEffect } from 'react' | ||
import { | ||
Box, | ||
Button, | ||
IconButton, | ||
SearchIcon, | ||
vars, | ||
} from '@0xsequence/design-system' | ||
import * as PopoverPrimitive from '@radix-ui/react-popover' | ||
import { AnimatePresence, motion } from 'framer-motion' | ||
|
||
import { AccountInformation } from './components/AccountInformation' | ||
import { WalletDropdownContent } from './components/WalletDropdownContent' | ||
|
||
|
||
export const HomeHeader = () => { | ||
const [openWalletDropdown, setOpenWalletDropdown] = useState<boolean>(false) | ||
|
||
const onClickAccount = () => { | ||
setOpenWalletDropdown(true) | ||
} | ||
|
||
const onClickSearch = () => { | ||
console.log('clicked search') | ||
} | ||
|
||
return ( | ||
<Box as={motion.div}> | ||
<PopoverPrimitive.Root open={openWalletDropdown}> | ||
<PopoverPrimitive.Anchor /> | ||
<Box background="backgroundPrimary" zIndex="20" position="fixed" width="full"> | ||
<IconButton | ||
onClick={onClickSearch} | ||
icon={SearchIcon} | ||
style={{ float: 'left', marginTop: '8px', backgroundColor: vars.colors.backgroundPrimary }} | ||
/> | ||
<PopoverPrimitive.Trigger asChild> | ||
<AccountInformation onClickAccount={onClickAccount} /> | ||
</PopoverPrimitive.Trigger> | ||
</Box> | ||
|
||
<AnimatePresence> | ||
{openWalletDropdown && ( | ||
<PopoverPrimitive.Portal | ||
> | ||
<PopoverPrimitive.Content | ||
asChild | ||
side="bottom" | ||
align="start" | ||
> | ||
<WalletDropdownContent /> | ||
</PopoverPrimitive.Content> | ||
</PopoverPrimitive.Portal> | ||
)} | ||
</AnimatePresence> | ||
</PopoverPrimitive.Root> | ||
</Box> | ||
) | ||
} |
Oops, something went wrong.