-
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.
Feature: Added Borrower + Page permission component + Connect Wallet …
…component (#701) Co-authored-by: Hugo Marques <[email protected]>
- Loading branch information
1 parent
4ab40ff
commit d7eb473
Showing
9 changed files
with
132 additions
and
16 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,38 @@ | ||
import { | ||
Box, | ||
Card, | ||
CircledIcon, | ||
Display, | ||
ViewContainer | ||
} from '@impact-market/ui'; | ||
import Message from 'src/libs/Prismic/components/Message'; | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const CardStyled = styled(Card)` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
text-align: center; | ||
gap: 1rem; | ||
padding: 2rem; | ||
`; | ||
|
||
const CheckPermission = ({ title }: { title?: string }) => ( | ||
<ViewContainer {...({} as any)}> | ||
{title && ( | ||
<Display g900 medium mb={2}> | ||
{title} | ||
</Display> | ||
)} | ||
<CardStyled> | ||
<CircledIcon icon="forbidden" error medium /> | ||
<Box> | ||
<Message id="noPermission" g900 large medium /> | ||
</Box> | ||
</CardStyled> | ||
</ViewContainer> | ||
); | ||
|
||
export default CheckPermission; |
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,72 @@ | ||
import { | ||
Box, | ||
Button, | ||
Card, | ||
CircledIcon, | ||
Display, | ||
ViewContainer | ||
} from '@impact-market/ui'; | ||
import Message from 'src/libs/Prismic/components/Message'; | ||
import React, { useState } from 'react'; | ||
import String from '../libs/Prismic/components/String'; | ||
import styled from 'styled-components'; | ||
import useWallet from 'src/hooks/useWallet'; | ||
|
||
const CardStyled = styled(Card)` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
text-align: center; | ||
gap: 1rem; | ||
padding: 2rem; | ||
`; | ||
|
||
const ConnectWallet = ({ title }: { title?: string }) => { | ||
const { connect } = useWallet(); | ||
|
||
const ConnectButton = (props: any) => { | ||
const [isConnecting, setIsConnecting] = useState(false); | ||
|
||
const handleConnectClick = async () => { | ||
setIsConnecting(true); | ||
|
||
await connect(); | ||
|
||
setIsConnecting(false); | ||
}; | ||
|
||
return ( | ||
<Button | ||
{...props} | ||
icon="coins" | ||
isLoading={isConnecting} | ||
onClick={handleConnectClick} | ||
secondary | ||
> | ||
<String id="connectWallet" /> | ||
</Button> | ||
); | ||
}; | ||
|
||
return ( | ||
<ViewContainer {...({} as any)}> | ||
{title && ( | ||
<Display g900 medium mb={2}> | ||
{title} | ||
</Display> | ||
)} | ||
<CardStyled> | ||
<CircledIcon icon="alertCircle" warning medium /> | ||
<Box> | ||
<Message id="connectWalletAccess" g900 large medium /> | ||
</Box> | ||
<Box margin="0 auto"> | ||
<ConnectButton /> | ||
</Box> | ||
</CardStyled> | ||
</ViewContainer> | ||
); | ||
}; | ||
|
||
export default ConnectWallet; |
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
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