1- <script setup>
2- import AuthenticatedLayout from " @/Layouts/AuthenticatedLayout.vue" ;
3- import { Head } from " @inertiajs/inertia-vue3" ;
4- import LessonCard from " @/Components/LessonCard.vue" ;
5-
6- // NOTE:
7- /*
8- Lesson data will be loaded and passed through to the grid component
9- When the component is interacted with, the component will handle its own
10- interaction event, but here another event will be made and it will
11- change current lesson data
12- */
13-
14- // Current lesson data
15- defineProps ([" curTitle" , " curDesc" , " curImage" ]);
16-
1+ <script >
2+ import AuthenticatedLayout from ' @/Layouts/AuthenticatedLayout.vue' ;
3+ import LessonCard from ' @/Components/LessonCard.vue' ;
4+ import LessonItem from ' @/Components/LessonItem.vue' ;
5+ export default {
6+ components: { AuthenticatedLayout, LessonCard, LessonItem },
7+ props: [' lessonData' ],
8+ data () {
9+ return {
10+ ' title' : ' Default title' ,
11+ ' desc' : ' Default description' ,
12+ ' img' : ' /images/placeholder.png' ,
13+ ' prevSelected' : 0
14+ }
15+ },created () {
16+ this .changeLessonCard (0 );
17+ }, methods: {
18+ changeLessonCard : function (index ) {
19+ this .lessonData [this .prevSelected ].selected = false ;
20+ this .prevSelected = index;
21+ this .lessonData [index].selected = true ;
22+ this .title = this .lessonData [index].title ;
23+ this .desc = this .lessonData [index].desc ;
24+ this .img = this .lessonData [index].src ;
25+ }
26+ }
27+ }
1728 </script >
1829
1930<template >
@@ -22,30 +33,16 @@ defineProps(["curTitle", "curDesc", "curImage"]);
2233 <AuthenticatedLayout >
2334 <div class =" flex justify-center mt-10" >
2435 <LessonCard
25- :title =" curTitle "
26- :description =" curDesc "
27- :image =" curImage "
36+ :title =" title "
37+ :description =" desc "
38+ :image =" img "
2839 />
29- <div class =" flex" >
40+ </div >
41+ <div class =" flex justify-center" >
42+ <div v-for =" (lesson, index) in lessonData"
43+ class =" " >
44+ <LessonItem :title =" lesson.title" :unlocked =" lesson.unlocked" :selected =" lesson.selected" v-on:click =" changeLessonCard(index)" />
3045 </div >
3146 </div >
3247 </AuthenticatedLayout >
3348</template >
34-
35- <!-- <template #header>
36- <h2 class="font-semibold text-xl text-gray-800 leading-tight">
37- Dashboard
38- </h2>
39- </template>
40-
41- <h2> SOmein</h2>
42-
43- <div class="py-12">
44- <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
45- <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
46- <div class="p-6 bg-white border-b border-gray-200">
47- You're logged in!
48- </div>
49- </div>
50- </div>
51- </div> -->
0 commit comments