Skip to content
Snippets Groups Projects

feat(cookies): MIN-201 add initial cookie banner

Merged mateusz-winiarczyk requested to merge MIN-201-initial-cookie-banner into development
1 unresolved thread
Short description:

Added initial cookie banner

Approach:

Implemented a CookieBanner component to inform users about cookies. The component conditionally displays a banner with the option to accept cookies, read more about the policy, and automatically accepts cookies. Redux manages the state, and local storage persists user preferences.

cookiebanner

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 import { selectCookieBanner } from '@/redux/cookieBanner/cookieBanner.selector';
2 import { acceptCookies, showBanner } from '@/redux/cookieBanner/cookieBanner.slice';
3 import { useAppDispatch } from '@/redux/hooks/useAppDispatch';
4 import { useAppSelector } from '@/redux/hooks/useAppSelector';
5 import { Button } from '@/shared/Button';
6 import Link from 'next/link';
7 import { useEffect } from 'react';
8 import { USER_ACCEPTED_COOKIES_COOKIE_NAME } from './CookieBanner.constants';
9
10 export const CookieBanner = (): React.ReactNode => {
11 const dispatch = useAppDispatch();
12 const { visible, accepted } = useAppSelector(selectCookieBanner);
13
14 useEffect(() => {
15 const isAccepted = localStorage.getItem(USER_ACCEPTED_COOKIES_COOKIE_NAME) === 'true';
  • LGTM. Great job!

  • Adrian Orłów approved this merge request

    approved this merge request

  • added 1 commit

    • 146f34f7 - refactor(cookies): extract cookie value to an constant

    Compare with previous version

  • Tadeusz Miesiąc approved this merge request

    approved this merge request

  • mateusz-winiarczyk added 23 commits

    added 23 commits

    Compare with previous version

  • added 3 commits

    Compare with previous version

  • mentioned in commit fc11105a

  • Please register or sign in to reply
    Loading