Skip to content

Commit

Permalink
Json Server API
Browse files Browse the repository at this point in the history
  • Loading branch information
nickunger99 committed Feb 10, 2022
1 parent 2548911 commit 29ea53d
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 22 deletions.
19 changes: 14 additions & 5 deletions src/app/models/Vagas.models.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
export class Vaga {
"id": number;
"nome": string;
"foto": string;
"descricao": string;
"salario": number;
id: number = 0;
nome: string = "";
foto: string = "";
descricao: string = "";
salario: number = 0;


constructor(id:number, nome:string, foto:string, descricao:string, salario:number){
this.id = id;
this.nome = nome;
this.foto = foto;
this.descricao = descricao;
this.salario = salario;
}
}
28 changes: 28 additions & 0 deletions src/app/mural-vagas/mural-vagas.component.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
header div{
width: 100%;
height: 50px;
}

.lista-vagas{
display: flex;
flex-direction: row;
justify-content: center;
}

.lista-vagas .card{
margin: 10px 20px;
min-height: 400px;
}

.card-vagas{
display: flex;
}

footer {
background: #343A40;
width: 100%;
height: 50px;
position: absolute;
bottom: 0;
left: 0;
}
40 changes: 28 additions & 12 deletions src/app/mural-vagas/mural-vagas.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
<div *ngFor="let vaga of vagas">


<div class="card" style="width: 18rem;">
<img src="assets\img\vagas\{{vaga.foto}}" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">Código da vaga: {{vaga.id}}</h5>
<h5 class="card-title">Vaga: {{vaga.nome}}</h5>
<p class="card-text"> Descrição da vaga: {{vaga.descricao}} </p>
<p class="card-text"> Salário: R$ {{vaga.salario}},00 </p>
<header>
<div class="p-3 mb-2 bg-warning text-dark"></div>
</header>
<section class="lista-vagas">
<div class="mt-5">
<div class="container">
<article class="card-vagas">
<div *ngFor="let vaga of vagas">
<div class="card" style="width: 18rem">
<img
src="assets\img\vagas\{{ vaga.foto }}"
class="card-img-top"
alt="..."
/>
<div class="card-body">
<h5 class="card-title">Código da vaga: {{ vaga.id }}</h5>
<h5 class="card-title">Vaga: {{ vaga.nome }}</h5>
<p class="card-text">Descrição da vaga: {{ vaga.descricao }}</p>
<p class="card-text">Salário: R$ {{ vaga.salario }},00</p>
</div>
</div>
</div>
</article>
</div>
</div>
</div>
</section>

</div>
<footer >

</footer>
8 changes: 7 additions & 1 deletion src/app/mural-vagas/mural-vagas.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ export class MuralVagasComponent implements OnInit {
retornaVaga => {
this.vagas = retornaVaga.map(
item => {
return new Vaga();
return new Vaga(
item.id,
item.nome,
item.foto,
item.descricao,
item.salario
);
}
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/vagas.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Vaga } from './models/Vagas.models';
})
export class VagasService {

private url = "";
private url = "http://localhost:3000/vagas";

constructor(private _httpClient: HttpClient) { }
getVagas(): Observable<Vaga[]>{
Expand Down
Binary file modified src/assets/img/vagas/foto2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/img/vagas/foto3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions vagas-db.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
{
"id": 1,
"nome": "Desenvolvedor Front End",
"foto": "foto1.jpg",
"foto": "foto1.png",
"descricao": "Trabalhar com Angular",
"salario": 5000
},
{
"id": 2,
"nome": "Desenvolvedor Fullstack Senior",
"foto": "foto2.jpg",
"foto": "foto2.png",
"descricao": "Trabalhar com Angular e Spring",
"salario": 10000
},
{
"id": 3,
"nome": "Desenvolvedor Back End Plenao",
"foto": "foto3.jpg",
"foto": "foto3.png",
"descricao": "Trabalhar com Spring Boot",
"salario": 5000
}
Expand Down

0 comments on commit 29ea53d

Please sign in to comment.