Skip to content

Commit

Permalink
Merge pull request #481 from lidofinance/feature/we-1424-ui-kit-make-…
Browse files Browse the repository at this point in the history
…sure-the-app-is-domain-agnostic

Added url param to cookie tooltip
  • Loading branch information
hexnickk4997 authored Jun 6, 2024
2 parents d3e7b3e + a3d6113 commit bfc98a9
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions packages/cookies-tooltip/cookies-tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { FC, useEffect, useState, useCallback } from 'react'
import {
FC,
useEffect,
useState,
useCallback,
ComponentPropsWithoutRef,
ReactNode,
} from 'react'
import { getCrossDomainCookieClientSide } from '../utils/index.js'
import {
Wrap,
Expand All @@ -12,7 +19,19 @@ import {
import { allowCookies, declineCookies } from './utils.js'
import { COOKIE_ALLOWED_KEY } from './constants.js'

export const CookiesTooltip: FC = () => {
export type CookiesTooltipProps = Omit<
ComponentPropsWithoutRef<'div'>,
'children'
> & {
privacyText?: ReactNode
privacyLink?: string
}

export const CookiesTooltip: FC<CookiesTooltipProps> = ({
privacyText,
privacyLink,
...rest
}) => {
const [isVisible, setVisibility] = useState(false)

const checkCookieAllowedEarlier = useCallback(() => {
Expand All @@ -39,12 +58,17 @@ export const CookiesTooltip: FC = () => {
if (!isVisible) return <></>

return (
<Wrap>
<Wrap {...rest}>
<Box>
<Text>
Cookies are used to collect anonymous site visitation data
to&nbsp;improve website performance. For&nbsp;more info, read&nbsp;
<ExternalLink href='https://lido.fi/privacy-notice'>
{privacyText ?? (
<>
Cookies are used to collect anonymous site visitation data
to&nbsp;improve website performance. For&nbsp;more info,
read&nbsp;
</>
)}
<ExternalLink href={privacyLink ?? 'https://lido.fi/privacy-notice'}>
Privacy Notice
</ExternalLink>
</Text>
Expand Down

0 comments on commit bfc98a9

Please sign in to comment.