-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from marbiano/accept-cookies
Accept cookies functionality
- Loading branch information
Showing
9 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...s/common/Featurebar/Featurebar.module.css → ...s/common/FeatureBar/FeatureBar.module.css
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 @@ | ||
export { default } from './FeatureBar' |
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
import { useEffect, useState } from 'react' | ||
import Cookies from 'js-cookie' | ||
|
||
const COOKIE_NAME = 'accept_cookies' | ||
|
||
export const useAcceptCookies = () => { | ||
const [acceptedCookies, setAcceptedCookies] = useState(true) | ||
|
||
useEffect(() => { | ||
if (!Cookies.get(COOKIE_NAME)) { | ||
setAcceptedCookies(false) | ||
} | ||
}, []) | ||
|
||
const acceptCookies = () => { | ||
setAcceptedCookies(true) | ||
Cookies.set(COOKIE_NAME, 'accepted', { | ||
expires: 365, | ||
}) | ||
} | ||
|
||
return { | ||
acceptedCookies, | ||
onAcceptCookies: acceptCookies, | ||
} | ||
} |
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
b6160b4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: