-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
5 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
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,29 @@ | ||
'use client'; | ||
|
||
import { useEffect, useState } from 'react'; | ||
import { useLocalStorage } from 'react-use'; | ||
import { Button } from '@/components/ui/button'; | ||
|
||
export default function CookieBanner() { | ||
const [hasAcceptedCookies, setHasAcceptedCookies] = useLocalStorage( | ||
'hasAcceptedCookies', | ||
false | ||
); | ||
const [isCookieBannerVisible, setIsCookieBannerVisible] = useState(false); | ||
|
||
useEffect(() => { | ||
if (!hasAcceptedCookies) setIsCookieBannerVisible(true); | ||
else setIsCookieBannerVisible(false); | ||
}, [hasAcceptedCookies]); | ||
|
||
return ( | ||
isCookieBannerVisible && ( | ||
<div className='absolute bottom-0 sticky z-50 w-full bg-zinc-800 border-t border-zinc-700 flex justify-center items-center gap-2 py-2 px-5 text-sm'> | ||
🍪 bu site çerezleri kullanır, devam ederek bunu kabul etmiş olursunuz. | ||
<Button onClick={() => setHasAcceptedCookies(true)} className='h-8'> | ||
anladım | ||
</Button> | ||
</div> | ||
) | ||
); | ||
} |