-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0ee6536
commit 772c82a
Showing
6 changed files
with
200 additions
and
1 deletion.
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
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,96 @@ | ||
<svelte:options tag="tree-popup" immutable={true} /> | ||
<script> | ||
import enLocale from '../../public/data/locales/en.json'; | ||
import { writable } from '../../utils/localstorage' | ||
export let show=true; | ||
export let message; | ||
export let locale = "en"; | ||
let language = []; | ||
language["en"] = enLocale; | ||
const cookiePolicy = localStorage.getItem('hidePlanetCookie') | ||
export const hideCookieNotification = writable(cookiePolicy) | ||
hideCookieNotification.subscribe(value => { | ||
localStorage.setItem('hidePlanetCookie', value === true ? true : false) | ||
}) | ||
function hideCookieNotice(){ | ||
show = false | ||
hideCookieNotification.set | ||
hideCookieNotification.update | ||
} | ||
</script> | ||
{#if show} | ||
<div class="cookiePolicy" > | ||
<div class="policyNotice"> | ||
{message} | ||
<a class="policyLink" href="https://www.plant-for-the-planet.org/en/footermenu/privacy-policy"> | ||
{language[locale].privacyPolicy} | ||
</a> | ||
</div> | ||
<button | ||
id={"cookieCloseButton"} | ||
class="primaryButton" | ||
on:click={hideCookieNotice} | ||
> | ||
{language[locale].acceptClose} | ||
</button> | ||
</div> | ||
{/if} | ||
<style> | ||
@import "https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap"; | ||
.cookiePolicy { | ||
position: fixed; | ||
background-color: white; | ||
box-shadow: 0px 3px 6px -3px ; | ||
bottom: 20px; | ||
left: 20px; | ||
width: 280px; | ||
border-radius: 4px; | ||
padding: 20px; | ||
z-index: 10; | ||
font-family: "Raleway", sans-serif; | ||
} | ||
.policyNotice { | ||
text-align: center; | ||
} | ||
.policyLink { | ||
font-weight: bold; | ||
text-decoration: none; | ||
color: #007a49; | ||
display: inline; | ||
} | ||
.primaryButton { | ||
color: white; | ||
font-weight: bold; | ||
background-image: linear-gradient(97deg, #68b030 4%, #007a49 116%); | ||
height: 40px; | ||
padding: 0px; | ||
text-align: center; | ||
border: 0px; | ||
border-radius: 40px; | ||
min-width: 200px; | ||
width: 100%; | ||
margin-top: 24px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
transition-duration: 0.5s; | ||
transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1); | ||
text-decoration: none; | ||
} | ||
.primaryButton:hover { | ||
transform: translateY(-7px); | ||
cursor: pointer; | ||
} | ||
</style> |
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,3 @@ | ||
import App from "./App.svelte"; | ||
|
||
export default App; |
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,30 @@ | ||
import {writable as internal, get} from 'svelte/store' | ||
export function writable(key, initialValue) { | ||
// create an underlying store | ||
const store = internal(initialValue) | ||
const {subscribe, set} = store | ||
// get the last value from localStorage | ||
const json = localStorage.getItem(key) | ||
|
||
// use the value from localStorage if it exists | ||
if (json) { | ||
set(JSON.parse(json)) | ||
} | ||
|
||
// return an object with the same interface as svelte's writable() | ||
return { | ||
// capture set and write to localStorage | ||
set(value) { | ||
localStorage.setItem(key, JSON.stringify(value)) | ||
set(value) | ||
}, | ||
// capture updates and write to localStore | ||
update(cb) { | ||
const value = cb(get(store)) | ||
this.set(value) | ||
}, | ||
// punt subscriptions to underlying store | ||
subscribe | ||
} | ||
} | ||
|