<template>
    <transition name="fade">
        <div v-if="!accepted" class="cookieconsent bg-brand-navy text-center text-white">
            <p>We use cookies to ensure you get the best experience.</p>
            <p>By continuing you agree to our <router-go to="/cookie-policy">Cookie Policy</router-go></p>
            <!--<p>-->
            <!--    <a href="https://www.cookiesandyou.com/" target="_blank">Learn More</a>-->
            <!--</p>-->
            <div class="cookieconsent__button bg-brand-purple rounded py-3 font-bold text-lg text-white cursor-pointer" @click="accept">Accept cookies</div>
        </div>
    </transition>
</template>

<script>
/* global localStorage */
export default {
    data() {
        return {
            accepted: true
        }
    },
    mounted() {
        let check = localStorage.getItem("cookieconsent");
        if (!check || check != 'true') this.accepted = false;
    },
    methods: {
        accept() {
            this.accepted = true;
            localStorage.setItem('cookieconsent', 'true');
        }
    }
}
</script>

<style lang="scss">
.cookieconsent {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 15px;
    z-index: 9999;

    
    @include min-bp($sm) {
        left: 20px;
        bottom: 20px;
        max-width: 320px;
        border-radius: 5px;
        padding: 20px 30px;
        
    }
    
    p {
        font-size: 16px;
        line-height: 1.25;
        max-width: 250px;
        margin: 6px auto;
        
        a {
            color: #fff;
            text-decoration: underline;
        }
    }
    
    &__button {
        margin-top: 10px;
        
        @include min-bp($sm) {
            margin-top: 15px;
        }
    }
}
</style>