Skip to content

Commit c95f3da

Browse files
committed
Update
1 parent 4fec94e commit c95f3da

27 files changed

+435
-0
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
3+
4+
const routes: Routes = [];
5+
6+
@NgModule({
7+
imports: [RouterModule.forRoot(routes)],
8+
exports: [RouterModule]
9+
})
10+
export class AppRoutingModule { }

webapp-027/src/app/app.component.css

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*Principal*/
2+
.espaco {
3+
margin: 20px;
4+
padding: 20px;
5+
}
6+
7+
.panel {
8+
border: 1px solid gray;
9+
border-radius: 5px;
10+
}
11+
12+
.logo {
13+
width: 8rem;
14+
height: 8rem;
15+
}
16+
17+
.btn {
18+
margin-left: 10px;
19+
}
20+
21+
.btn-size {
22+
width: 150px;
23+
}
24+
25+
26+
27+
28+

webapp-027/src/app/app.component.html

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--Principal-->
2+
<div class="container panel panel-default espaco">
3+
4+
5+
<!-- Navegação -->
6+
<div class="row">
7+
<!--Logo-->
8+
<div class="col-sm-6 col-xs-12">
9+
10+
<img src="../assets/logo1.png" class="logo">
11+
</div>
12+
13+
<!--Botoes-->
14+
<div class="col-sm-6 col-xs-12 text-right">
15+
<button (click)="MostrarLoja()" class="btn btn-primary btn-size"> Loja </button>
16+
<button (click)="MostrarStock()" class="btn btn-primary btn-size"> Estoque </button>
17+
</div>
18+
</div>
19+
20+
21+
22+
23+
24+
<app-loja *ngIf="loja_visivel"></app-loja>
25+
26+
<app-stock *ngIf="stock_visivel"></app-stock>
27+
</div>
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { RouterTestingModule } from '@angular/router/testing';
3+
import { AppComponent } from './app.component';
4+
5+
describe('AppComponent', () => {
6+
beforeEach(async () => {
7+
await TestBed.configureTestingModule({
8+
imports: [
9+
RouterTestingModule
10+
],
11+
declarations: [
12+
AppComponent
13+
],
14+
}).compileComponents();
15+
});
16+
17+
it('should create the app', () => {
18+
const fixture = TestBed.createComponent(AppComponent);
19+
const app = fixture.componentInstance;
20+
expect(app).toBeTruthy();
21+
});
22+
23+
it(`should have as title 'webapp-027'`, () => {
24+
const fixture = TestBed.createComponent(AppComponent);
25+
const app = fixture.componentInstance;
26+
expect(app.title).toEqual('webapp-027');
27+
});
28+
29+
it('should render title', () => {
30+
const fixture = TestBed.createComponent(AppComponent);
31+
fixture.detectChanges();
32+
const compiled = fixture.nativeElement as HTMLElement;
33+
expect(compiled.querySelector('.content span')?.textContent).toContain('webapp-027 app is running!');
34+
});
35+
});

webapp-027/src/app/app.component.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-root',
5+
templateUrl: './app.component.html',
6+
styleUrls: ['./app.component.css']
7+
})
8+
export class AppComponent {
9+
title = 'webapp-027';
10+
11+
//variaveis que controlam a visibilidade dos componentes
12+
loja_visivel: boolean = true;
13+
stock_visivel: boolean = false;
14+
15+
16+
//Função MostrarLoja, apresenta a loja e remove o stock
17+
MostrarLoja(){
18+
this.loja_visivel = true;
19+
this.stock_visivel = false;
20+
}
21+
22+
//Função MostrarStock, apresenta a stock e remove a loja
23+
MostrarStock(){
24+
this.loja_visivel = false;
25+
this.stock_visivel = true;
26+
}
27+
28+
}

webapp-027/src/app/app.module.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
4+
import { AppRoutingModule } from './app-routing.module';
5+
import { AppComponent } from './app.component';
6+
import { LojaComponent } from './loja/loja.component';
7+
import { StockComponent } from './stock/stock.component';
8+
9+
@NgModule({
10+
declarations: [
11+
AppComponent,
12+
LojaComponent,
13+
StockComponent
14+
],
15+
imports: [
16+
BrowserModule,
17+
AppRoutingModule
18+
],
19+
providers: [],
20+
bootstrap: [AppComponent]
21+
})
22+
export class AppModule { }
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* Loja */
2+
.espaco{
3+
margin: 20px;
4+
padding: 20px;
5+
}
6+
7+
.panel {
8+
border: 1px solid gray;
9+
border-radius: 5px;
10+
}
11+
12+
.btn {
13+
margin-left: 10px;
14+
}
15+
16+
.btn-size {
17+
width: 150px;
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!-- Loja -->
2+
<div class="row panel panel-default espaco">
3+
4+
5+
<!-- Titulo -->
6+
<div class="row"><h3> Loja </h3></div>
7+
8+
9+
<!-- Conteudo Dinamico -->
10+
<div class="row">
11+
<i *ngFor="let produto of produtos">
12+
<div class="col-xs-3">
13+
<img src="../../assets/{{ produto.icon }}" alt=""><span> {{ produto.nome }}</span>
14+
</div>
15+
</i>
16+
</div>
17+
18+
19+
<!-- Botões -->
20+
<div class="row text-right">
21+
<button (click)="AdcAbacaxi()" class="btn btn-primary">+ Abacaxi</button>
22+
<button (click)="AdcBanana()" class="btn btn-primary">+ Banana</button>
23+
<button (click)="AdcLaranja()" class="btn btn-primary">+ Laranja</button>
24+
</div>
25+
26+
27+
28+
29+
30+
31+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { LojaComponent } from './loja.component';
4+
5+
describe('LojaComponent', () => {
6+
let component: LojaComponent;
7+
let fixture: ComponentFixture<LojaComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ LojaComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(LojaComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* Loja */
2+
import { Component, OnInit } from '@angular/core';
3+
4+
@Component({
5+
selector: 'app-loja',
6+
templateUrl: './loja.component.html',
7+
styleUrls: ['./loja.component.css']
8+
})
9+
export class LojaComponent {
10+
11+
produtos = [];
12+
13+
14+
AdcAbacaxi(){
15+
//Adiciona um abacaxi ao componente
16+
this.produtos.push({
17+
'icon': 'ico_abacaxi.png',
18+
'nome': 'Abacaxi'
19+
});
20+
}
21+
22+
AdcBanana(){
23+
//Adiciona uma banana ao componente
24+
this.produtos.push({
25+
'icon': 'ico_banana.png',
26+
'nome': 'Banana'
27+
});
28+
}
29+
30+
AdcLaranja(){
31+
//Adiciona uma laranja ao componente
32+
this.produtos.push({
33+
'icon': 'ico_laranja.png',
34+
'nome': 'Laranja'
35+
});
36+
}
37+
38+
}

webapp-027/src/app/stock/stock.component.css

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>Estoque</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { StockComponent } from './stock.component';
4+
5+
describe('StockComponent', () => {
6+
let component: StockComponent;
7+
let fixture: ComponentFixture<StockComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ StockComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(StockComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-stock',
5+
templateUrl: './stock.component.html',
6+
styleUrls: ['./stock.component.css']
7+
})
8+
export class StockComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit(): void {
13+
}
14+
15+
}

webapp-027/src/assets/.gitkeep

Whitespace-only changes.

webapp-027/src/assets/abacaxi.png

22.4 KB
Loading

webapp-027/src/assets/banana.png

3.63 KB
Loading

webapp-027/src/assets/laranja.png

24.2 KB
Loading

webapp-027/src/assets/logo1.png

61.2 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true
3+
};
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This file can be replaced during build by using the `fileReplacements` array.
2+
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
3+
// The list of file replacements can be found in `angular.json`.
4+
5+
export const environment = {
6+
production: false
7+
};
8+
9+
/*
10+
* For easier debugging in development mode, you can import the following file
11+
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12+
*
13+
* This import should be commented out in production mode because it will have a negative impact
14+
* on performance if an error is thrown.
15+
*/
16+
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.

webapp-027/src/favicon.ico

66.1 KB
Binary file not shown.

webapp-027/src/index.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Loja</title>
6+
<base href="/">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="icon" type="image/x-icon" href="favicon.ico">
9+
<!--CDN Bootstrap-->
10+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/4.6.1/js/bootstrap.min.js">
11+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css">
12+
</head>
13+
<body>
14+
15+
16+
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
17+
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
18+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js"></script>
19+
<app-root></app-root>
20+
</body>
21+
</html>

webapp-027/src/main.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { enableProdMode } from '@angular/core';
2+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3+
4+
import { AppModule } from './app/app.module';
5+
import { environment } from './environments/environment';
6+
7+
if (environment.production) {
8+
enableProdMode();
9+
}
10+
11+
platformBrowserDynamic().bootstrapModule(AppModule)
12+
.catch(err => console.error(err));

0 commit comments

Comments
 (0)