forked from keep-starknet-strange/zkramp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new swap page (keep-starknet-strange#102)
* feat: new swap page * feat: Account selection modal --------- Co-authored-by: Chqrles <[email protected]>
- Loading branch information
Showing
10 changed files
with
222 additions
and
66 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 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,24 @@ | ||
import { ThemedText } from 'src/theme/components' | ||
import styled from 'styled-components' | ||
|
||
const StyledChipButton = styled(ThemedText.BodySecondary)<{ active?: boolean }>` | ||
background-color: ${({ theme }) => theme.bg3}; | ||
color: ${({ theme, active }) => (active ? theme.neutral1 : theme.neutral2)}; | ||
border: none; | ||
border-radius: 99px; | ||
padding: 8px 16px; | ||
cursor: pointer; | ||
transition: background-color 0.2s ease; | ||
&:hover { | ||
background-color: ${({ theme }) => theme.bg2}; | ||
} | ||
` | ||
|
||
interface ChipButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { | ||
active?: boolean | ||
} | ||
|
||
export function ChipButton({ active, ...props }: ChipButtonProps) { | ||
return <StyledChipButton as="button" active={active} {...props} /> | ||
} |
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 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 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,68 @@ | ||
import { useCloseModal, useSelectAccountModal } from 'src/hooks/useModal' | ||
import { ThemedText } from 'src/theme/components' | ||
import { RevolutLogo, VenmoLogo } from 'src/theme/components/icons' | ||
import styled from 'styled-components' | ||
|
||
import { PrimaryButton } from '../Button' | ||
import { Column, Row } from '../Flex' | ||
import Content from '../Modal/Content' | ||
import Overlay from '../Modal/Overlay' | ||
import Portal from '../Portal' | ||
|
||
const AccountButtons = styled(Column)` | ||
width: 100%; | ||
` | ||
|
||
const StyledAccountModal = styled(Row)` | ||
width: 100%; | ||
justify-content: space-between; | ||
padding: 16px; | ||
background-color: ${({ theme }) => theme.bg3}; | ||
color: ${({ theme }) => theme.neutral1}; | ||
border: none; | ||
border-radius: 12px; | ||
cursor: pointer; | ||
` | ||
|
||
interface AccountButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { | ||
Logo: React.FC<React.SVGProps<SVGSVGElement>> | ||
name: string | ||
currencies: string[] | ||
} | ||
|
||
const AccountButton = ({ Logo, name, currencies, ...props }: AccountButtonProps) => { | ||
return ( | ||
<StyledAccountModal as="button" {...props}> | ||
<Row gap={16}> | ||
<Logo width={22} height={22} /> | ||
|
||
<ThemedText.HeadlineSmall>{name}</ThemedText.HeadlineSmall> | ||
</Row> | ||
|
||
<ThemedText.BodySecondary>{currencies.join(', ')}</ThemedText.BodySecondary> | ||
</StyledAccountModal> | ||
) | ||
} | ||
|
||
export default function SelectAccountModal() { | ||
// modal | ||
const [isOpen] = useSelectAccountModal() | ||
const close = useCloseModal() | ||
|
||
if (!isOpen) return null | ||
|
||
return ( | ||
<Portal> | ||
<Content title="Select account" close={close}> | ||
<AccountButtons gap={16}> | ||
<AccountButton Logo={RevolutLogo} name="Revolut" currencies={['EUR', 'USD']} /> | ||
<AccountButton Logo={VenmoLogo} name="Venmo" currencies={['USD']} /> | ||
</AccountButtons> | ||
|
||
<PrimaryButton>Register new account</PrimaryButton> | ||
</Content> | ||
|
||
<Overlay onClick={close} /> | ||
</Portal> | ||
) | ||
} |
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 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 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 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
Oops, something went wrong.