Skip to content

Commit 1e7c2e2

Browse files
committed
ContentPage - ContentCards (Desktop)
1 parent 6cda5a4 commit 1e7c2e2

13 files changed

+174
-5
lines changed

src/app/screens/content/content.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141

4242
</aside>
4343
<section class="t4e-content-items">
44-
44+
<t4e-content-card
45+
*ngFor="let contentItem of contentItems"
46+
[contentItem]="contentItem"
47+
></t4e-content-card>
4548
</section>
4649
</div>
4750

src/app/screens/content/content.component.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
display: grid;
99
grid-template-columns: 1fr 3fr;
1010
grid-template-areas: 'filters content-items';
11+
grid-column-gap: 110px;
1112

1213
.t4e-content-filters {
1314
grid-area: filters;
@@ -80,5 +81,13 @@
8081

8182
.t4e-content-items {
8283
grid-area: content-items;
84+
85+
display: grid;
86+
grid-template-columns: repeat(2, 1fr);
87+
grid-auto-rows: minmax(320px, 1fr);
88+
89+
grid-row-gap: 40px;
90+
grid-column-gap: 24px;
91+
8392
}
8493
}

src/app/screens/content/content.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ const GET_CONTENT_ITEMS = gql`
3333
videoTime,
3434
imageUrl,
3535
createdAt,
36-
updatedAt
36+
updatedAt,
37+
stakeholder {
38+
code
39+
}
40+
provider {
41+
code
42+
}
3743
}
3844
3945
}
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
<p>content-card works!</p>
1+
<div [class]="'content-card ' + contentItem.type.toLowerCase()"
2+
[ngStyle]="{backgroundImage: getBackgroundImage()}"
3+
>
4+
<div class="provider" *ngIf="contentItem.provider">
5+
<img [class]="'provider-img ' + contentItem.provider.code.toLowerCase()" [src]="'../../../assets/card/' + getProviderImage()" alt="">
6+
</div>
7+
<div class="overlay"></div>
8+
<div class="text-wrapper">
9+
<div class="text-wrapper__title">{{contentItem.title}}</div>
10+
<div class="text-wrapper__time" *ngIf="contentItem.videoTime">{{contentItem.videoTime}}min</div>
11+
</div>
12+
<div class="action">
13+
<span>{{contentItem.type === 'CONTENT-TUTORIAL-VIDEO' ? 'VER VÍDEO' : 'VER ARTIGO '}}</span>
14+
<svg width="21" height="16" viewBox="0 0 21 16" fill="none" xmlns="http://www.w3.org/2000/svg">
15+
<path d="M14.3 15L20 8L14.3 1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
16+
<path d="M20 8H1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
17+
</svg>
18+
</div>
19+
</div>
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
@import 'theme';
2+
3+
.content-card {
4+
position: relative;
5+
display: flex;
6+
flex-direction: column;
7+
8+
width: 315px;
9+
height: 289px;
10+
11+
12+
background-repeat: no-repeat;
13+
14+
mask: url(/assets/card/card-content-aluno.png);
15+
mask-size: cover;
16+
17+
transition: 0.2s ease box-shadow, 0.2s ease transform;
18+
19+
cursor: pointer;
20+
21+
&.content-article {
22+
background-position: 97% 35%;
23+
background-size: 131%;
24+
mask-size: contain;
25+
mask-repeat: no-repeat;
26+
27+
.overlay {
28+
width: 100%;
29+
height: 289px;
30+
position: absolute;
31+
bottom: 0;
32+
left: 0;
33+
background: linear-gradient(0deg, #5A98D0 0%, rgba(90, 152, 208, 0) 59.37%);
34+
z-index: -1;
35+
}
36+
}
37+
38+
&:hover {
39+
transform: scale(1.0225);
40+
}
41+
42+
.provider {
43+
width: 207px;
44+
height: 207px;
45+
position: absolute;
46+
background-color: #FFF;
47+
opacity: 0.9;
48+
border-radius: 50%;
49+
left: -17.95%;
50+
right: 53.53%;
51+
top: -29.29%;
52+
bottom: 57.5%;
53+
54+
img {
55+
position: absolute;
56+
57+
&.zoom {
58+
top: 44%;
59+
left: 33%;
60+
}
61+
62+
&.teams {
63+
top: 52%;
64+
left: 41%;
65+
}
66+
67+
}
68+
}
69+
70+
.text-wrapper {
71+
display: flex;
72+
align-items: flex-end;
73+
margin: auto 24px 8px;
74+
75+
&__title {
76+
@include font('title3', 130%);
77+
color: #FFF;
78+
margin-right: 6px;
79+
}
80+
81+
&__time {
82+
@include font('bodyTextHighlight', 152%);
83+
color: #FFF;
84+
}
85+
}
86+
87+
.action {
88+
margin-left: 24px;
89+
margin-bottom: 24px;
90+
color: #FFF;
91+
span {
92+
@include font('button');
93+
margin-right: 4px;
94+
}
95+
svg {
96+
width: 15px;
97+
height: 11px;
98+
}
99+
}
100+
}
Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import {Component, Input, OnInit} from '@angular/core';
2+
import {IContentItem} from '../../interfaces/content-item.interface';
23

34
@Component({
45
selector: 't4e-content-card',
@@ -7,9 +8,38 @@ import { Component, OnInit } from '@angular/core';
78
})
89
export class ContentCardComponent implements OnInit {
910

11+
@Input() contentItem: IContentItem = {};
12+
1013
constructor() { }
1114

1215
ngOnInit(): void {
16+
17+
}
18+
19+
getProviderImage() {
20+
switch(this.contentItem.provider.code) {
21+
case 'TEAMS':
22+
return 'card-provider-teams.png';
23+
case 'ZOOM':
24+
return 'card-provider-zoom.png'
25+
default:
26+
return '';
27+
}
28+
}
29+
30+
getBackgroundImage() {
31+
if (this.contentItem.imageUrl) {
32+
return 'url('+ this.contentItem.imageUrl +')'
33+
} else {
34+
switch(this.contentItem.stakeholder.code) {
35+
case 'PROFESSOR':
36+
return 'url(/assets/card/card-content-professor.png)';
37+
case 'ALUNO':
38+
return 'url(/assets/card/card-content-aluno.png)';
39+
case 'PAIS':
40+
return 'url(/assets/card/card-content-ee.png)';
41+
}
42+
}
1343
}
1444

1545
}

src/app/shared/filters/filters.component.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
background: #FFF;
2020
justify-content: flex-start;
2121

22+
cursor: pointer;
23+
2224
transition:
2325
color 250ms ease,
2426
background 250ms ease

src/app/shared/shared.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ import { ContentCardComponent } from './content-card/content-card.component';
3232
PageHeaderComponent,
3333
FooterComponent,
3434
BlogArticleCardComponent,
35-
FiltersComponent
35+
FiltersComponent,
36+
ContentCardComponent
3637
]
3738
})
3839
export class SharedModule { }
106 KB
Loading

src/assets/card/card-content-ee.png

129 KB
Loading
105 KB
Loading
2.59 KB
Loading
3.5 KB
Loading

0 commit comments

Comments
 (0)