-
Notifications
You must be signed in to change notification settings - Fork 465
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display legal disclaimer to first time swappers
- Loading branch information
Showing
13 changed files
with
177 additions
and
86 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import Disclaimer from './index' | ||
import LegalDisclaimerContent from '@/components/common/LegalDisclaimerContent' | ||
|
||
const meta = { | ||
component: Disclaimer, | ||
parameters: { | ||
componentSubtitle: 'Renders an information block intended for users whose address is blocked by OFAC', | ||
}, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof Disclaimer> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const BlockedAddress: Story = { | ||
args: { | ||
subtitle: '0xD3a484faEa53313eF85b5916C9302a3E304ae622', | ||
title: 'Blocked Address', | ||
buttonText: 'continue', | ||
content: | ||
'This signer address is blocked by the Safe interface, due to being associated with the blocked activities by the U.S. Department of Treasury in the Specially Designated Nationals (SDN) list.', | ||
onAccept: () => {}, | ||
}, | ||
parameters: { | ||
design: { | ||
type: 'figma', | ||
url: 'https://www.figma.com/file/VyA38zUPbJ2zflzCIYR6Nu/Swap?node-id=6167%3A14371&mode=dev', | ||
}, | ||
}, | ||
} | ||
|
||
export const LegalDisclaimer: Story = { | ||
args: { | ||
title: 'Legal Disclaimer', | ||
content: <LegalDisclaimerContent withTitle={false} />, | ||
buttonText: 'continue', | ||
onAccept: () => {}, | ||
}, | ||
} |
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,50 @@ | ||
import type { ReactElement, ReactNode } from 'react' | ||
import { Box, Button, Divider, Paper, Stack, SvgIcon, Typography } from '@mui/material' | ||
import InfoIcon from '@/public/images/notifications/info.svg' | ||
import css from './styles.module.css' | ||
|
||
export const Disclaimer = ({ | ||
title, | ||
subtitle, | ||
buttonText, | ||
content, | ||
onAccept, | ||
}: { | ||
title: string | ||
subtitle?: string | ||
buttonText?: string | ||
content: ReactNode | ||
onAccept: () => void | ||
}): ReactElement => { | ||
return ( | ||
<div className={css.container}> | ||
<Paper sx={{ maxWidth: '500px' }}> | ||
<Stack | ||
padding="var(--space-3)" | ||
gap={2} | ||
display="flex" | ||
alignItems="center" | ||
sx={({ palette }) => ({ borderBottom: `1px solid ${palette.border.light}` })} | ||
> | ||
{subtitle && <Typography color="var(--color-text-Secondary, #A1A3A7)">{subtitle}</Typography>} | ||
|
||
<Box className={css.iconCircle}> | ||
<SvgIcon component={InfoIcon} inheritViewBox fontSize="medium" /> | ||
</Box> | ||
<Typography variant="h3" fontWeight={700}> | ||
{title} | ||
</Typography> | ||
<Typography variant="body2">{content}</Typography> | ||
<Divider /> | ||
</Stack> | ||
<Box display="flex" justifyContent="center" pt={3} pb={2}> | ||
<Button variant="contained" size="small" sx={{ px: '16px' }} onClick={onAccept}> | ||
{buttonText || 'Got it'} | ||
</Button> | ||
</Box> | ||
</Paper> | ||
</div> | ||
) | ||
} | ||
|
||
export default Disclaimer |
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,14 @@ | ||
.container { | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.iconCircle { | ||
color: var(--color-info-main); | ||
border-radius: 50%; | ||
display: flex; | ||
padding: var(--space-1); | ||
background: #d7f6ff; | ||
} |
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
9 changes: 9 additions & 0 deletions
9
src/components/common/LegalDisclaimerContent/styles.module.css
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,9 @@ | ||
|
||
.disclaimerContainer p, | ||
.disclaimerContainer h3 { | ||
line-height: 24px; | ||
} | ||
|
||
.disclaimerInner p { | ||
text-align: justify; | ||
} |
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,22 @@ | ||
import { useCallback } from 'react' | ||
import useLocalStorage from '@/services/local-storage/useLocalStorage' | ||
|
||
const SWAPS_CONSENT_STORAGE_KEY = 'swapConsent' | ||
|
||
const useSafeAppsInfoModal = (): { | ||
isConsentAccepted: boolean | ||
onAccept: () => void | ||
} => { | ||
const [isConsentAccepted = false, setIsConsentAccepted] = useLocalStorage<boolean>(SWAPS_CONSENT_STORAGE_KEY) | ||
|
||
const onAccept = useCallback(() => { | ||
setIsConsentAccepted(true) | ||
}, [setIsConsentAccepted]) | ||
|
||
return { | ||
isConsentAccepted, | ||
onAccept, | ||
} | ||
} | ||
|
||
export default useSafeAppsInfoModal |
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