<script setup>
import { ref, onMounted, computed, reactive } from 'vue'
import { useStore } from "vuex";
import { useRouter } from "vue-router";
const store = useStore();
const route = useRouter();
let setting = computed(() => store.state.settings)
let data = computed(() => store.state.mainPage)
let loader = computed(() => store.state.mainPageLoader)
const normal = async()=>{
    store.dispatch('mainPageLoader', true)
    if(data.value.length == 0){
        await axios.post('/api/setting-get').then(response => {
            axios.post('/api/all-page/abouts').then(response => {
                let d = response.data.data
                store.dispatch('mainPage', d)
                store.dispatch('mainPageLoader', false)
            })
        })
    }else{
        axios.post('/api/all-page/abouts').then(response => {
            let d = response.data.data
            store.dispatch('mainPage', d)
            store.dispatch('mainPageLoader', false)
        })
    }

}
onMounted(async () => {
    window.scrollTo(0, 0);
    normal()
    store.dispatch('mobileMenuHideShow', false)  
    store.dispatch("SearchText", null)
    store.dispatch('rightSidebar', false)
    store.dispatch('LeftCategorySidebar',false)
    store.dispatch('CartCompare','0px')
    store.dispatch('HeaderFooterOff',true)
})

</script>
<template>
<main class="main">
    <div class="page-content">
        <div class="container-fluid">
            <div class="top-section">
                <div class="page-background-image">
                    <div class="page-img" :style="{'background-image': 'url(' + setting.frontend_img_url+'/storage/image/webPageImage/' + data.image+')'}" v-if="setting.frontend_img_url"></div>
                    <div class="page-title">About Us</div>
                    <div class="link">
                        <ul>
                            <li><router-link to="/about-us">About us</router-link></li>
                            <li><router-link to="/contact-us">Contact us</router-link></li>
                            <li><router-link to="/faq">FAQ</router-link></li>
                            <li><router-link to="/privacy-policy">Privacy Policy</router-link></li>
                            <li><router-link to="/team">Team</router-link></li>
                            <li><router-link to="/terms-and-conditions">Terms & Condition</router-link></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="main-section mt-5 mb-10" v-if="!loader">
                <div v-html="data.text"></div>
            </div>
            <!-- Loader -->
            <div class="loader mt-5" style="height: 100vh" v-if="loader">
                <svg class="pl" viewBox="0 0 200 200" width="200" height="200" xmlns="http://www.w3.org/2000/svg">
                    <defs>
                        <linearGradient id="pl-grad1" x1="1" y1="0.5" x2="0" y2="0.5">
                            <stop offset="0%" stop-color="hsl(313,90%,55%)" />
                            <stop offset="100%" stop-color="hsl(223,90%,55%)" />
                        </linearGradient>
                        <linearGradient id="pl-grad2" x1="0" y1="0" x2="0" y2="1">
                            <stop offset="0%" stop-color="hsl(313,90%,55%)" />
                            <stop offset="100%" stop-color="hsl(223,90%,55%)" />
                        </linearGradient>
                    </defs>
                    <circle class="pl__ring" cx="100" cy="100" r="82" fill="none" stroke="url(#pl-grad1)" stroke-width="36" stroke-dasharray="0 257 1 257" stroke-dashoffset="0.01" stroke-linecap="round" transform="rotate(-90,100,100)" />
                    <line class="pl__ball" stroke="url(#pl-grad2)" x1="100" y1="18" x2="100.01" y2="182" stroke-width="36" stroke-dasharray="1 165" stroke-linecap="round" />
                </svg>
            </div>
        </div><!-- End .container -->
    </div><!-- End .page-content -->
</main><!-- End .main -->
</template>
<style scoped>
.loader{
    width: 100%;
    display:flex;
    justify-content: center;
    margin-bottom: 100px;
}
.router-link-active.router-link-exact-active{
    border-bottom: 2px solid v-bind(setting.color);
}
.page-img{
    background-size: cover; 
    background-position: center center; 
    background-repeat: no-repeat;
}
.page-content{
    padding-bottom:0;
}
.page-background-image{
    position: relative;
}
.page-background-image .page-img {
    min-height: 350px;
    transition: .5s ease-in-out;
    background-color: #ccc;
}
.page-background-image .page-title {
    font-size: 28px;
    font-weight: 700;
    position: absolute;
    text-align: center;
    color: #fff;
    top: 40%;
    left: 0;
    right: 0;
    margin: auto;
}
.link{
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    bottom: 25px;
}
ul{
    overflow: auto;
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: center;
}
li{
    color: #fff;
    display: inline-block;
    font-size: 16px;
    margin-left: 20px;
    line-height: 22px;
    opacity: .9;
    list-style: disc;
    color: red;
}
li a{
    text-decoration: none;
    color: #fff;
    font-weight: 600;
}

.pl {
	display: block;
	width: 6.25em;
	height: 6.25em;
}
.pl__ring, .pl__ball {
	animation: ring 2s ease-out infinite;
}
.pl__ball {
	animation-name: ball;
}

/* Dark theme  */
@media (prefers-color-scheme: dark) {
	:root {
		--bg: hsl(var(--hue),10%,10%);
		--fg: hsl(var(--hue),10%,90%);
	}
}

/* Animation */
@keyframes ring {
	from {
		stroke-dasharray: 0 257 0 0 1 0 0 258;
	}
	25% {
		stroke-dasharray: 0 0 0 0 257 0 258 0;
	}
	50%, to {
		stroke-dasharray: 0 0 0 0 0 515 0 0;
	}
}
@keyframes ball {
	from, 50% {
		animation-timing-function: ease-in;
		stroke-dashoffset: 1;
	}
	64% {
		animation-timing-function: ease-in;
		stroke-dashoffset: -109;
	}
	78% {
		animation-timing-function: ease-in;
		stroke-dashoffset: -145;
	}
	92% {
		animation-timing-function: ease-in;
		stroke-dashoffset: -157;
	}
	57%, 71%, 85%, 99%, to {
		animation-timing-function: ease-out;
		stroke-dashoffset: -163;
	}
}
</style>