Skip to content

Commit

Permalink
feat: using ConnectWalletModal
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcase committed Aug 23, 2023
1 parent af84a84 commit 6ff1c91
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
9 changes: 6 additions & 3 deletions ui/summit-2023/src/components/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Hero: React.FC = () => {
display: 'flex',
flexDirection: { xs: 'column', sm: 'row' },
height: { xs: 'auto', sm: '400px' },
marginLeft: isMobile ? '0px' : '50px'
marginLeft: isMobile ? '0px' : '50px',
}}
>
<Box
Expand All @@ -39,7 +39,10 @@ const Hero: React.FC = () => {
order: { xs: '1', sm: '1' },
}}
>
<div className="left-title-container" style={{ marginTop: isMobile ? '0px' : '15%' }}>
<div
className="left-title-container"
style={{ marginTop: isMobile ? '0px' : '15%' }}
>
<Typography
className="title"
variant="h2"
Expand All @@ -66,7 +69,7 @@ const Hero: React.FC = () => {
sx={{
flex: '1',
padding: '20px',
marginLeft: isMobile ? '0px' : '40px',
marginLeft: isMobile ? '0px' : '40px',
order: { xs: '2', sm: '2' },
}}
>
Expand Down
33 changes: 33 additions & 0 deletions ui/summit-2023/src/components/common/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,39 @@ import MenuIcon from '@mui/icons-material/Menu';
import CloseIcon from '@mui/icons-material/Close';
import './Header.scss';
import { i18n } from '../../../i18n';
import ConnectWalletModal from '../../ConnectWalletModal/ConnectWalletModal';
import { useCardano } from '@cardano-foundation/cardano-connect-with-wallet';
import toast from 'react-hot-toast';

const Header: React.FC = () => {
const [drawerOpen, setDrawerOpen] = useState(false);
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));

const { stakeAddress, isConnected, signMessage } = useCardano();
const [isDisabled, setIsDisabled] = useState<boolean>(false);
const [showVoteReceipt, setShowVoteReceipt] = useState<boolean>(false);
const [openAuthDialog, setOpenAuthDialog] = useState<boolean>(false);
const [optionId, setOptionId] = useState('');

const notify = (message: string) => toast(message);

const handleCloseAuthDialog = () => {
setOpenAuthDialog(false);
};

const onConnectWallet = () => {
setOpenAuthDialog(false);
notify('Wallet Connected!');
};

const drawerItems = (
<List>
<ListItem style={{ justifyContent: 'space-between' }}>
<Button
className="connect-button"
color="inherit"
onClick={() => setOpenAuthDialog(true)}
>
{i18n.t('header.connectWalletButton')}
</Button>
Expand Down Expand Up @@ -127,6 +148,7 @@ const Header: React.FC = () => {
<Button
className="connect-button"
color="inherit"
onClick={() => setOpenAuthDialog(true)}
>
{i18n.t('header.connectWalletButton')}
</Button>
Expand All @@ -146,6 +168,17 @@ const Header: React.FC = () => {
>
{drawerItems}
</Drawer>

<ConnectWalletModal
openStatus={openAuthDialog}
onCloseFn={handleCloseAuthDialog}
name="connect-wallet-list"
id="connect-wallet-list"
title="Choose your preferred wallet to connect"
action
buttonLabel="Close"
onConnectWallet={onConnectWallet}
/>
</>
);
};
Expand Down
5 changes: 3 additions & 2 deletions ui/summit-2023/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
font-weight: 400;
src: url(./common/resources/fonts/Roboto-Light.ttf) format('ttf');
}
body, html {
body,
html {
margin: 0;
padding: 0;
overflow-x: hidden;
}
}

0 comments on commit 6ff1c91

Please sign in to comment.