-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Link to privacy policy + GDPR (#645)
Resolves #587 What has been done: - Added privacy policy to the DApp - Added reusable `Popup` component (used in privacy policy and `Assistant`)
- Loading branch information
Showing
10 changed files
with
225 additions
and
83 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,88 @@ | ||
import React, { ReactNode } from "react" | ||
import { animated } from "@react-spring/web" | ||
import { useVisibilityTransition } from "shared/hooks" | ||
import Icon from "shared/components/Icon" | ||
import closeIcon from "shared/assets/icons/s/close.svg" | ||
|
||
export type PopupProps = { | ||
children: ReactNode | ||
isVisible: boolean | ||
close: () => void | ||
leftPosition?: string | number | ||
bottomPosition: string | number | ||
rightPosition?: string | number | ||
width: string | number | ||
hasPointer?: boolean | ||
style?: React.CSSProperties | ||
} | ||
|
||
type XAxisPsition = { | ||
left?: string | number | ||
right?: string | number | ||
} | ||
|
||
export default function Popup({ | ||
children, | ||
isVisible, | ||
close, | ||
bottomPosition, | ||
leftPosition, | ||
rightPosition, | ||
width, | ||
hasPointer = true, | ||
style, | ||
}: PopupProps) { | ||
const transition = useVisibilityTransition(isVisible) | ||
const xPosition: XAxisPsition = {} | ||
|
||
if (leftPosition !== null) xPosition.left = leftPosition | ||
if (rightPosition !== null) xPosition.right = rightPosition | ||
|
||
return ( | ||
<> | ||
<animated.div | ||
style={{ | ||
position: "absolute", | ||
bottom: bottomPosition, | ||
background: "#043937", | ||
borderRadius: 16, | ||
padding: "24px 32px 32px", | ||
width, | ||
pointerEvents: isVisible ? "all" : "none", | ||
...transition, | ||
...xPosition, | ||
...style, | ||
}} | ||
> | ||
<button | ||
type="button" | ||
className="close_button button_reset" | ||
onClick={close} | ||
> | ||
<Icon src={closeIcon} width="16px" height="16px" /> | ||
</button> | ||
<div className="content">{children}</div> | ||
</animated.div> | ||
<style jsx>{` | ||
.close_button { | ||
position: absolute; | ||
top: 14px; | ||
right: 16px; | ||
padding: 0; | ||
} | ||
.content::after { | ||
display: ${hasPointer ? "block" : "none"}; | ||
content: ""; | ||
background: #043937; | ||
height: 12px; | ||
width: 12px; | ||
position: absolute; | ||
bottom: -4px; | ||
right: 26px; | ||
border-radius: 2px; | ||
rotate: 45deg; | ||
} | ||
`}</style> | ||
</> | ||
) | ||
} |
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,73 @@ | ||
import React from "react" | ||
import Popup from "shared/components/Popup" | ||
import cookiesIcon from "shared/assets/icons/cookies.svg" | ||
import newTabIcon from "shared/assets/icons/s/new-tab.svg" | ||
import { LINKS, LOCAL_STORAGE_COOKIES } from "shared/constants" | ||
import { useLocalStorageChange } from "shared/hooks" | ||
import Icon from "./Icon" | ||
import Button from "./Button" | ||
|
||
export default function PrivacyPolicy() { | ||
const { value, updateStorage } = useLocalStorageChange<boolean>( | ||
LOCAL_STORAGE_COOKIES | ||
) | ||
|
||
const closePopup = () => updateStorage(true) | ||
|
||
return ( | ||
<> | ||
<Popup | ||
isVisible={value === null} | ||
close={closePopup} | ||
bottomPosition={16} | ||
leftPosition={19} | ||
width={419} | ||
hasPointer={false} | ||
style={{ zIndex: "var(--z-assistant-icon)" }} | ||
> | ||
<div className="header row_center"> | ||
<Icon src={cookiesIcon} type="image" height="29px" width="29px" /> | ||
<span>We respect your privacy</span> | ||
</div> | ||
<p className="content"> | ||
Continuing to use the website means you are accepting our cookie | ||
policy. | ||
</p> | ||
<div className="row_center" style={{ gap: 38 }}> | ||
<Button type="secondary" onClick={closePopup}> | ||
OK | ||
</Button> | ||
<a | ||
href={LINKS.PRIVACY_POLICY} | ||
title="Privacy policy" | ||
className="privacy_link row_center" | ||
target="_blank" | ||
rel="noreferrer" | ||
> | ||
<span>Privacy policy</span> | ||
<Icon src={newTabIcon} type="image" height="16px" width="16px" /> | ||
</a> | ||
</div> | ||
</Popup> | ||
<style jsx>{` | ||
.header { | ||
margin-bottom: 16px; | ||
gap: 8px; | ||
} | ||
.header span { | ||
font-size: 20px; | ||
color: var(--secondary-s1-90); | ||
} | ||
.content { | ||
color: var(--secondary-s1-70); | ||
margin-bottom: 16px; | ||
} | ||
.privacy_link { | ||
font-weight: 600; | ||
gap: 8px; | ||
color: var(--primary-p2-100); | ||
} | ||
`}</style> | ||
</> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,29 @@ | ||
import React, { ReactNode } from "react" | ||
import { animated } from "@react-spring/web" | ||
import { useVisibilityTransition } from "shared/hooks" | ||
import Icon from "shared/components/Icon" | ||
import closeIcon from "shared/assets/icons/s/close.svg" | ||
import React, { CSSProperties, ReactNode } from "react" | ||
import Popup from "shared/components/Popup" | ||
|
||
export type AssistantContentProps = { | ||
type AssistantContentProps = { | ||
children: ReactNode | ||
isVisible: boolean | ||
close: () => void | ||
style?: React.CSSProperties | ||
style?: CSSProperties | ||
} | ||
|
||
export default function AssistantContent({ | ||
children, | ||
isVisible, | ||
close, | ||
style, | ||
}: AssistantContentProps & { children: ReactNode }) { | ||
const transition = useVisibilityTransition(isVisible) | ||
|
||
}: AssistantContentProps) { | ||
return ( | ||
<> | ||
<animated.div | ||
style={{ | ||
...transition, | ||
position: "absolute", | ||
bottom: "calc(100% + 16px)", | ||
right: 0, | ||
background: "#043937", | ||
borderRadius: 16, | ||
padding: "24px 32px 32px", | ||
width: 375, | ||
pointerEvents: isVisible ? "all" : "none", | ||
...style, | ||
}} | ||
> | ||
<button | ||
type="button" | ||
className="close_button button_reset" | ||
onClick={close} | ||
> | ||
<Icon src={closeIcon} width="16px" height="16px" /> | ||
</button> | ||
<div className="content">{children}</div> | ||
</animated.div> | ||
<style jsx>{` | ||
.close_button { | ||
position: absolute; | ||
top: 14px; | ||
right: 16px; | ||
padding: 0; | ||
} | ||
.content::after { | ||
content: ""; | ||
background: #043937; | ||
height: 12px; | ||
width: 12px; | ||
position: absolute; | ||
bottom: -4px; | ||
right: 26px; | ||
border-radius: 2px; | ||
rotate: 45deg; | ||
} | ||
`}</style> | ||
</> | ||
<Popup | ||
isVisible={isVisible} | ||
close={close} | ||
style={style} | ||
bottomPosition="calc(100% + 16px)" | ||
rightPosition={0} | ||
width={375} | ||
> | ||
{children} | ||
</Popup> | ||
) | ||
} |