-
Notifications
You must be signed in to change notification settings - Fork 1
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
9 changed files
with
174 additions
and
130 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
File renamed without changes.
55 changes: 55 additions & 0 deletions
55
ui/summit-2023/src/components/ConnectWalletList/ConnectWalletList.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,55 @@ | ||
import React from 'react'; | ||
import { Avatar, List, ListItem, ListItemAvatar, Typography } from '@mui/material'; | ||
import { useCardano } from '@cardano-foundation/cardano-connect-with-wallet'; | ||
import './ConnectWalletList.scss'; | ||
import { walletIcon } from '../../utils/utils'; | ||
|
||
type ConnectWalletModalProps = { | ||
description: string; | ||
onConnectWallet: () => void; | ||
onConnectError: () => void; | ||
}; | ||
|
||
// TODO: move to .env file | ||
// TODO: handle mobile support. Flint | ||
const SUPPORTED_WALLETS = ['flint', 'nami', 'eternl', 'typhon', 'yoroi', 'nufi']; | ||
|
||
const ConnectWalletList = (props: ConnectWalletModalProps) => { | ||
const { description, onConnectWallet, onConnectError } = props; | ||
const { installedExtensions, connect } = useCardano(); | ||
|
||
const availableWallets = installedExtensions.filter((installedWallet) => SUPPORTED_WALLETS.includes(installedWallet)); | ||
|
||
return ( | ||
<> | ||
<Typography | ||
className="connect-wallet-modal-description" | ||
gutterBottom | ||
style={{ wordWrap: 'break-word' }} | ||
> | ||
{description} | ||
</Typography> | ||
<List> | ||
{availableWallets.map((walletName, index) => ( | ||
<ListItem | ||
key={index} | ||
className="walletItem" | ||
onClick={() => connect(walletName, onConnectWallet, onConnectError)} | ||
> | ||
<ListItemAvatar> | ||
<Avatar | ||
src={walletIcon(walletName)} | ||
style={{ width: '24px', height: '24px' }} | ||
/> | ||
</ListItemAvatar> | ||
<Typography className="walletLabel"> | ||
Connect <span className="walletName">{walletName}</span> wallet | ||
</Typography> | ||
</ListItem> | ||
))} | ||
</List> | ||
</> | ||
); | ||
}; | ||
|
||
export default ConnectWalletList; |
96 changes: 0 additions & 96 deletions
96
ui/summit-2023/src/components/ConnectWalletModal/ConnectWalletModal.tsx
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
@import './src/common/styles/colors'; | ||
|
||
.closeButton.MuiButtonBase-root { | ||
background-color: var(--color-ultra-light-blue); | ||
} | ||
|
||
.closeButton.MuiButtonBase-root:hover { | ||
background-color: var(--color-ultra-light-blue); | ||
opacity: 0.9; | ||
} | ||
|
||
.modal-title { | ||
color: var(--color-ultra-dark-blue); | ||
font-size: 28px !important; | ||
font-style: normal; | ||
font-weight: 600 !important; | ||
line-height: normal; | ||
float: left; | ||
} | ||
|
||
.modal-description { | ||
color: var(--color-medium-grey); | ||
font-size: 16px !important; | ||
font-style: normal; | ||
font-weight: 400 !important; | ||
line-height: 22px; | ||
} |
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 from 'react'; | ||
import Dialog from '@mui/material/Dialog'; | ||
import DialogContent from '@mui/material/DialogContent'; | ||
import DialogTitle from '@mui/material/DialogTitle'; | ||
import { IconButton, Typography } from '@mui/material'; | ||
import CloseIcon from '@mui/icons-material/Close'; | ||
import Paper from '@mui/material/Paper'; | ||
import './Modal.scss'; | ||
|
||
const StyledPaper = (props: any) => { | ||
return ( | ||
<Paper | ||
{...props} | ||
style={{ borderRadius: '16px' }} | ||
/> | ||
); | ||
}; | ||
|
||
type ModalProps = { | ||
name: string; | ||
id: string; | ||
isOpen: boolean; | ||
title: string; | ||
width?: string; | ||
onClose: () => void; | ||
children: React.ReactNode; | ||
}; | ||
|
||
const Modal = (props: ModalProps) => { | ||
const { name, id, isOpen, title, width, onClose } = props; | ||
|
||
return ( | ||
<Dialog | ||
open={isOpen} | ||
onClose={onClose} | ||
aria-labelledby={name} | ||
maxWidth='sm' | ||
PaperComponent={StyledPaper} | ||
> | ||
<DialogTitle | ||
id={id} | ||
style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }} | ||
> | ||
<Typography className='modal-title'>{title}</Typography> | ||
<IconButton | ||
className='closeButton' | ||
edge='end' | ||
color='inherit' | ||
onClick={onClose} | ||
> | ||
<CloseIcon /> | ||
</IconButton> | ||
</DialogTitle> | ||
<DialogContent style={{ width: width || '400px' }}>{props.children}</DialogContent> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default Modal; |
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