Skip to content

Commit

Permalink
feat: changed to default content
Browse files Browse the repository at this point in the history
  • Loading branch information
hexnickk4997 committed Jun 5, 2024
1 parent 51d0707 commit 782bf54
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions packages/cookies-tooltip/cookies-tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { FC, useEffect, useState, useCallback, ComponentPropsWithoutRef } from 'react'
import {
FC,
useEffect,
useState,
useCallback,
ComponentPropsWithoutRef,
} from 'react'
import { getCrossDomainCookieClientSide } from '../utils/index.js'
import {
Wrap,
Expand All @@ -12,12 +18,21 @@ import {
import { allowCookies, declineCookies } from './utils.js'
import { COOKIE_ALLOWED_KEY } from './constants.js'

export type CookiesTooltipProps = ComponentPropsWithoutRef<'div'> & {
privacyNoticeUrl?: string
}
const DefaultContent = () => (
<>
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'>
Privacy Notice
</ExternalLink>
</>
)

export type CookiesTooltipProps = ComponentPropsWithoutRef<'div'>

export const CookiesTooltip: FC<CookiesTooltipProps> = ({
privacyNoticeUrl = 'https://lido.fi/privacy-notice'
children,
...rest
}) => {
const [isVisible, setVisibility] = useState(false)

Expand Down Expand Up @@ -45,15 +60,9 @@ export const CookiesTooltip: FC<CookiesTooltipProps> = ({
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={privacyNoticeUrl}>
Privacy Notice
</ExternalLink>
</Text>
<Text>{children ?? <DefaultContent />}</Text>
<ButtonsWrap>
<AllowButton
onClick={() => {
Expand Down

0 comments on commit 782bf54

Please sign in to comment.