Skip to content

Commit

Permalink
Merge pull request #534 from matematikk-mooc/aj/DIT-124
Browse files Browse the repository at this point in the history
DIT-124: Added tags to cards
  • Loading branch information
madsenandreas authored Jun 3, 2024
2 parents 20d430f + 7c0d2e0 commit 301abe0
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 12 deletions.
33 changes: 32 additions & 1 deletion src/vue/components/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
<slot name="description"></slot>
<slot name="moduleList"></slot>
</p>

<ul class="card-content-tags">
<template v-for="filterItem in filters" :key="filterItem.filter_id">
<li>{{ filterItem.filter.filter_name }}</li>
</template>
</ul>

<div class="card-content-enrolled">
<img
v-if="hasGoToCourse"
Expand Down Expand Up @@ -51,6 +58,7 @@ export default {
theme: String,
courseIllustration: String,
label: String,
filters: Array
},
data() {
return {
Expand All @@ -67,13 +75,13 @@ export default {
.card-box {
position: relative;
width: 24rem;
min-height: 28rem;
display: flex;
flex-direction: column;
justify-content: space-evenly;
border-radius: 0.5rem;
box-shadow: 0 0.25rem 0.25rem 0 rgba(0, 0, 0, 0.25);
background-color: $card-background-color;
height: 100%;
.card-illustration-box {
position: relative;
Expand Down Expand Up @@ -136,6 +144,29 @@ export default {
justify-content: flex-start;
}
.card-content-tags {
display: flex;
flex-direction: row;
justify-content: flex-start;
flex-wrap: wrap;
list-style-type: none;
padding: 0px;
margin: 0px;
margin-top: 10px;
}
.card-content-tags li {
background: #eaeaf5;
padding: 4px 15px;
margin: 0px;
margin-right: 8px;
margin-bottom: 8px;
border-radius: 20px;
font-size: 14px;
font-weight: 400;
line-height: 21px;
}
.card-content-button-container {
margin-top: 1.5rem;
margin-bottom: 1rem;
Expand Down
32 changes: 31 additions & 1 deletion src/vue/components/CardHighlighted.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
<slot name="description"></slot>
<slot name="moduleList"></slot>
</p>

<ul class="card-highlighted-content-tags">
<template v-for="filterItem in filters" :key="filterItem.filter_id">
<li>{{ filterItem.filter.filter_name }}</li>
</template>
</ul>

<div class="card-highlighted-content-button-container">
<slot name="leftButton"></slot>
<slot name="rightButton"></slot>
Expand All @@ -36,6 +43,7 @@ export default {
theme: String,
courseIllustration: String,
label: String,
filters: Array
},
data() {
return {
Expand All @@ -52,7 +60,6 @@ export default {
.card-highlighted-box {
position: relative;
width: 24rem;
min-height: 24rem;
display: flex;
flex-direction: column;
justify-content: space-evenly;
Expand Down Expand Up @@ -121,6 +128,29 @@ export default {
justify-content: flex-start;
}
.card-highlighted-content-tags {
display: flex;
flex-direction: row;
justify-content: flex-start;
flex-wrap: wrap;
list-style-type: none;
padding: 0px;
margin: 0px;
margin-top: 10px;
}
.card-highlighted-content-tags li {
background: #eaeaf5;
padding: 4px 15px;
margin: 0px;
margin-right: 8px;
margin-bottom: 8px;
border-radius: 20px;
font-size: 14px;
font-weight: 400;
line-height: 21px;
}
.card-highlighted-content-button-container {
margin-top: 1.5rem;
margin-bottom: 1rem;
Expand Down
12 changes: 8 additions & 4 deletions src/vue/components/CardList.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

<template>
<div class="card-container">
<div v-for="course in courses" :key="course.id">
<div v-for="course in courses" :key="course.id" class="card-container-wrapper">
<Card class="card-item"
:theme="course.course_settings ? course.course_settings.course_category.category.color_code : 'theme_0'"
:courseIllustration="course.course_settings ? course.course_settings.image.path : ''"
:label="course.name"
:filters="course.course_settings ? course.course_settings.course_filter : []"
>
<template v-slot:new-flag>
<NewCourseFlag v-if="newCoursesIndicator && newCourseFlag(course)"/>
Expand Down Expand Up @@ -198,9 +199,11 @@ export default {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 140rem;
width: 100%;
align-items: flex-start;
justify-content: flex-start;
gap: 32px 24px;
margin-bottom: 40px;
@media (max-width: 1025px) {
width: 64rem;
Expand All @@ -212,8 +215,9 @@ export default {
}
}
.card-item {
margin: 0.25rem 1.5rem 2rem 0;
.card-container-wrapper {
position: relative;
align-self: stretch;
}
.course-illustration-box {
Expand Down
8 changes: 2 additions & 6 deletions src/vue/components/NotLoggedInIntro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
:theme="newestCourse.course_settings ? newestCourse.course_settings.course_category.category.color_code : 'theme_0'"
:courseIllustration="newestCourse.course_settings ? newestCourse.course_settings.image.path : ''"
:label="newestCourse.name"
:filters="newestCourse.course_settings ? newestCourse.course_settings.course_filter : []"
>
<template v-slot:new-flag>
<NewCourseFlag v-if="newCourseFlag()"></NewCourseFlag>
Expand Down Expand Up @@ -171,6 +172,7 @@ export default {
box-sizing: border-box;
padding: 0.5rem 6rem 0.5rem 9rem;
margin-top: 1rem;
margin-bottom: 20px;
display: inline-grid;
grid-template-columns: auto auto;
justify-content: center;
Expand Down Expand Up @@ -202,14 +204,8 @@ export default {
}
.card-highlighted {
max-height: 100px !important;
box-sizing: border-box !important;
justify-content: space-between !important;
.card-box {
min-height: 24rem;
}
}
.course-illustration-box {
Expand Down

0 comments on commit 301abe0

Please sign in to comment.