<template>
    <div>
                                                <!-- Hero Section -->
        <section class="container-fluid shadow-2xl">
            <div class="bg-gradient-to-t from-blue-200 hero-text font-bold text-blue-700 text-center py-24 md:py-48 px-4">Videos for <span class="text-color-1">Mathematics</span></div>
            <!-- Age Filter Triger -->
            <!-- <div class="bg3 flex flex-col md:flex-row justify-center md:justify-end lg:px-48 px-4 pt-5 shadow-xl lg:gap-4">
                <div class="flex">
                    <h1 class=" pt-3 font-semibold py-8">Age:&nbsp;</h1>
                    <select class="select max-w-xs bg3">
                        <option>Select your Age</option>
                        <option>2-3 Year</option>
                        <option>3-4 Year</option>
                        <option>4-5 Year</option>
                        <option>5-6 Year</option> 
                    </select>
                </div> 
            </div> -->
        </section>
        <section class="container mx-auto pt-10 px-6 xl:px-24">
            <span class="h1-text text-color-1">All Videos</span>
            <p class="font-20px  text-color-2 pb-16 text-justify">Learning becomes easy with videos for preschoolers by Teeny Beans Preschool Curriculum that assists in a stronger foundation in Mathematics to instill the accurate skills and knowledge among children and practice time saving learning. </p>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-10 place-items-center">
                <div v-for="videobooks in vbmath" :key="vbmath.id" class="grid">
                    <div @click="showYtModal(videobooks.youtube_id)">
                    <div  class="grid place-items-center">
                        <div class="relative rounded-tl-xl rounded-br-xl bg-gray-200 rotate-6">
                            <img class="w-96 relative -rotate-6 rounded-tl-xl rounded-br-xl cursor-pointer" v-if="videobooks.img" :src="'https://curriculum-app-api.beanstalkedu.com/assets/'+ videobooks.img" alt=""/>
                            <img class="absolute inset-24 lg:inset-16 left-36 lg:left-24 w-16 cursor-pointer" src="/img/svg/play.svg" alt=""/>
                        </div>
                        <h1 class="text-center pt-4 w-fit font-20px">{{videobooks.title}}</h1>
                        <!-- <button class="bg-blue-700 p-1 text-white pl-4 pr-4 rounded-tl-lg rounded-br-lg ml-6 mt-8"><img class="w-5 pr-1 inline" src="/img/download.png" alt="">Download</button> -->
                    </div>
                </div>
            </div> 
            </div>
        </section>
        <section class="container mx-auto pt-10 px-6 xl:px-24 mb-16">
            <a href="/premium">
                <div class="flex prime-bg p-10 relative justify-center">
                    <h1 class="flex text-center justify-center absolute inset-0 pb-40 place-items-center text-4xl text-white">Subscribe To Our Plan <br> To View More</h1>
                    <div class="flex justify-center absolute inset-0 place-items-center">
                        <button class="bg-yellow-500 p-2 px-4 text-xl rounded-br-xl rounded-tl-xl text-white">Subscribe Now</button></div>
                    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-10 place-items-center opacity-20">
                        <div v-for="videobooks in vbfmath" :key="vbfmath.id" class="grid">
                            <div  class="grid place-items-center">
                                <div class="flex rounded-tl-xl rounded-br-xl bg-gray-200 rotate-6">
                                    <img class="-rotate-6 rounded-tl-xl rounded-br-xl" v-if="videobooks.img" :src="'https://curriculum-app-api.beanstalkedu.com/assets/'+ videobooks.img" alt=""/>
                                    <img class="absolute inset-24 lg:inset-16 left-36 lg:left-24 w-16" src="/img/svg/play.svg" alt=""/>
                                </div>
                                    <h1 class="text-center pt-4 w-fit">{{videobooks.title}}</h1>
                            </div>
                        </div>
                    </div>
                </div>
            </a>
        </section>
                                     <!-- Youtube Modal -->
        <div @click="hideYtModal" v-if="ytModal" id="ytModal" class="flex justify-center ytModal">
            <div class="modal-content">
                <span  @click="hideYtModal" class="close">&times;</span>
                <div>
                    <iframe width="380" height="320" :src="'https://www.youtube.com/embed/'+ytID"></iframe>
                </div>
            </div>
        </div>
    </div>
</template>
<style scoped>
.bg3 {
  background: linear-gradient(0deg, rgb(191, 219, 254, 1) 0%, rgba(255, 255, 255) 100%);
}
.font-20px {
    font-size: 20px;
}
@media screen and (min-width: 801px) {
  .hero-text {
    font-size: 50px;
    
    
  } 
}

@media screen and (max-width: 800px) {
  .hero-text {
    font-size: 25px;
    
  }
}
@media screen and (min-width: 801px) {
  .h1-text {
    font-size: 40px;
    
    
  } 
}

@media screen and (max-width: 800px) {
  .h1-text {
    font-size: 25px;
    
  }
}
.ytModal {
  /* display: none;  */
  position: fixed;
  width: 80%;
  z-index: 999991;
  padding-top: 100px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0,0.4);
}
.text-color-1 {
    color: #7C4C23;
}
.prime-bg {
    background-color: rgba(0, 0, 0, 0.2);
}

</style>
<script>
export default {
    setup(){
    // const route = useRoute(); 
},
    

    data() {
        return {
            page: null,
            videobooks: null,
            vbmath: null,
            wsMath: null,
            wsWorld: null,
            vbfmath: null,
            isLoading: true,
            ytModal:false,
            ytID:''

        }
    },
    methods: { 
        showYtModal(ytID){
            this.ytModal=true
            this.ytID=ytID
        },
        hideYtModal(){
            this.ytModal=false
            // this.ytID=ytID
        }    
    },
    mounted: function () {
        fetch('https://curriculum-app-api.beanstalkedu.com/items/video_book?filter[category][_eq]=mathematics')
            .then(resp => resp.json())
            .then(videobooks => {
                this.vbmath=videobooks.data
                // console.log(this.vbmath)
            })
            fetch('https://curriculum-app-api.beanstalkedu.com/items/video_book?filter[category][_eq]=mathematics&limit=5')
            .then(resp => resp.json())
            .then(videobooks => {
                this.vbfmath=videobooks.data
                // console.log(this.vbfmath)
            })
       
        }
    }
</script>

