Re-factored CourseCard UI

This commit is contained in:
scmmishra 2018-11-02 20:51:24 +05:30 committed by Aditya Hase
parent 6678f5b88e
commit e30f2eb297
2 changed files with 28 additions and 3 deletions

View File

@ -12,9 +12,7 @@
</span>
</div>
<div class='course-buttons text-center col-xs-4 col-sm-3 col-md-2'>
<button class='btn btn-primary btn-sm btn-block' @click="$router.push($route.path + '/' + course.name + '/' + nextContentType + '/' + nextContent)">Start Course</button>
<button class='btn btn-primary btn-sm btn-block'>Continue</button>
<button class='btn btn-success btn-sm btn-block'>Completed</button>
<AcademyCourseCardButton :course="course.name" :nextContent="nextContent" :nextContentType="nextContentType"/>
</div>
</div>
</div>
@ -22,6 +20,8 @@
</template>
<script>
import AcademyCourseCardButton from './AcademyCourseCardButton.vue'
export default {
props: ['course'],
name: "AcademyCourseCard",
@ -41,6 +41,9 @@ export default {
this.nextContent = r.message.content,
this.nextContentType = r.message.content_type
});
},
components: {
AcademyCourseCardButton
}
};
</script>

View File

@ -0,0 +1,22 @@
<template>
<button :class="className" class='btn btn-primary btn-sm btn-block' @click="$router.push($route.path + '/' + course + '/' + nextContentType + '/' + nextContent)">{{ buttonName }}</button>
</template>
<script>
export default {
props: ['course', 'nextContent', 'nextContentType'],
name: "AcademyCourseCardButton",
data() {
return {
buttonName: 'Start',
className: 'btn-primary'
}
},
mounted() {
if(this.$root.$data.checkCourseCompletion(this.course)){
console.log('Completed', this.course)
this.buttonName = 'Completed'
this.className = 'btn-success'
}
}
};
</script>