Skip to content

Commit b428fbf

Browse files
committed
Catalogue: Simplify CatalogueCourseCard usage, adjust styles, and clean up unused CSS classes #5652
1 parent 102596c commit b428fbf

5 files changed

Lines changed: 19 additions & 30 deletions

File tree

assets/css/scss/organisms/_cards.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
}
1212

1313
.p-card-header {
14+
@apply relative;
15+
1416
img {
15-
@apply rounded-t-lg aspect-video;
17+
@apply rounded-t-lg object-cover;
1618
}
1719
}
1820

@@ -33,7 +35,7 @@
3335
}
3436

3537
.p-card-footer {
36-
@apply mt-auto rounded-b-lg;
38+
@apply mt-auto rounded-b-lg space-y-2;
3739
}
3840

3941
.p-menu {

assets/css/scss/organisms/_course_card.scss

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22
.course-card {
33

44
&__header {
5-
@apply relative aspect-video w-full overflow-hidden rounded-t-lg bg-gray-25 ;
6-
}
7-
8-
.p-card-header {
9-
@apply relative;
5+
@apply aspect-video w-full overflow-hidden rounded-t-lg bg-gray-25 ;
106
}
117

128
&__category-list {
13-
@apply absolute top-2 left-2 flex flex-wrap gap-1 z-10;
9+
@apply absolute top-2 left-2 flex flex-wrap gap-1;
1410
}
1511

1612
&__title {
@@ -28,7 +24,7 @@
2824
}
2925

3026
&__language {
31-
@apply absolute bottom-2 right-2 z-10;
27+
@apply absolute bottom-2 right-2;
3228
}
3329
}
3430
}

assets/vue/components/course/CatalogueCourseCard.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,10 @@ onMounted(() => {
314314
v-if="imageLink"
315315
:to="imageLink"
316316
aria-label="Open course"
317-
class="absolute inset-0 block"
318317
>
319318
<img
320319
:alt="localCourse.title"
321320
:src="localCourse.illustrationUrl"
322-
class="h-full w-full object-cover"
323321
loading="lazy"
324322
referrerpolicy="no-referrer"
325323
/>
@@ -328,7 +326,6 @@ onMounted(() => {
328326
v-else
329327
:alt="localCourse.title"
330328
:src="localCourse.illustrationUrl"
331-
class="w-full object-cover"
332329
/>
333330
334331
<BaseButton
@@ -421,22 +418,22 @@ onMounted(() => {
421418
{{ t("Your vote") }} [{{ localVote }}]
422419
</span>
423420
</div>
421+
</template>
424422
423+
<template #footer>
425424
<template
426425
v-for="extraField in localCourse.extra_fields"
427426
:key="extraField.variable"
428427
>
429428
<div
430429
v-if="extraField.value"
431-
class="text-caption flex gap-2"
430+
class="text-caption space-x-2"
432431
>
433432
<strong v-text="extraField.text" />
434433
<span v-text="extraField.value" />
435434
</div>
436435
</template>
437-
</template>
438436
439-
<template #footer>
440437
<BaseAppLink
441438
v-if="localCourse.subscribed"
442439
:to="{ name: 'CourseHome', params: { id: localCourse.id } }"

assets/vue/components/course/CourseCard.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
<template>
22
<Card class="course-card">
33
<template #header>
4-
<div class="relative aspect-video w-full overflow-hidden rounded-t-2xl bg-gray-100">
4+
<div class="course-card__header">
55
<img
66
v-if="isLocked"
77
:alt="course.title || 'Course illustration'"
88
:src="imageUrl"
9-
class="absolute inset-0 h-full w-full object-cover"
109
loading="lazy"
1110
referrerpolicy="no-referrer"
1211
/>
1312
<BaseAppLink
1413
v-else
1514
:to="{ name: 'CourseHome', params: { id: course._id }, query: { sid: sessionId } }"
1615
aria-label="Open course"
17-
class="absolute inset-0 block"
1816
>
1917
<img
2018
:alt="course.title || 'Course illustration'"
2119
:src="imageUrl"
22-
class="h-full w-full object-cover"
2320
loading="lazy"
2421
referrerpolicy="no-referrer"
2522
/>

assets/vue/views/course/CatalogueCourses.vue

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,16 @@
6969
</div>
7070

7171
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4">
72-
<div
72+
<CatalogueCourseCard
7373
v-for="course in visibleCoursesBase"
7474
:key="course.id"
75-
>
76-
<CatalogueCourseCard
77-
:card-extra-fields="cardExtraFields"
78-
:course="course"
79-
:current-user-id="currentUserId"
80-
:show-title="showCourseTitle"
81-
@rate="onRatingChange"
82-
@subscribed="onUserSubscribed"
83-
/>
84-
</div>
75+
:card-extra-fields="cardExtraFields"
76+
:course="course"
77+
:current-user-id="currentUserId"
78+
:show-title="showCourseTitle"
79+
@rate="onRatingChange"
80+
@subscribed="onUserSubscribed"
81+
/>
8582
</div>
8683

8784
<div ref="sentinel">

0 commit comments

Comments
 (0)