Commit 21c400ff81ee7b0f3f43812acce7bd88fa5ad0de
1 parent
fbfb312d3f
Exists in
master
Cambio en componente home, agregadas rutas.
Showing
6 changed files
with
60 additions
and
44 deletions
Show diff stats
src/app/app-routing.module.ts
1 | import { NgModule } from '@angular/core'; | 1 | import { NgModule } from '@angular/core'; |
2 | import { Routes, RouterModule } from '@angular/router'; | 2 | import { Routes, RouterModule } from '@angular/router'; |
3 | import { HomeComponent } from './home/home.component'; | ||
4 | import { CargarProductosComponent } from './cargar-productos/cargar-productos.component'; | ||
3 | 5 | ||
4 | const routes: Routes = []; | 6 | const routes: Routes = [ |
7 | { path: 'home', component: HomeComponent }, | ||
8 | { path: 'cargar-productos', component: CargarProductosComponent }, | ||
9 | { path: '**', redirectTo: '/home', pathMatch: 'full' }, | ||
10 | ]; | ||
5 | 11 | ||
6 | @NgModule({ | 12 | @NgModule({ |
7 | imports: [RouterModule.forRoot(routes)], | 13 | imports: [RouterModule.forRoot(routes)], |
8 | exports: [RouterModule] | 14 | exports: [RouterModule] |
9 | }) | 15 | }) |
10 | export class AppRoutingModule { } | 16 | export class AppRoutingModule { } |
11 | 17 |
src/app/app.component.html
1 | <div class="container-fluid h-100"> | ||
2 | <div class="row h-100"> | ||
3 | <div class="col p-0"> | ||
4 | <app-home class="w-100 h-100 d-flex align-items-start flex-column"></app-home> | ||
5 | </div> | ||
6 | </div> | ||
7 | </div> | ||
8 | <router-outlet></router-outlet> | 1 | <router-outlet></router-outlet> |
src/app/app.module.ts
1 | import { BrowserModule } from '@angular/platform-browser'; | 1 | import { BrowserModule } from '@angular/platform-browser'; |
2 | import { NgModule } from '@angular/core'; | 2 | import { NgModule } from '@angular/core'; |
3 | 3 | ||
4 | import { AppRoutingModule } from './app-routing.module'; | 4 | import { AppRoutingModule } from './app-routing.module'; |
5 | import { AppComponent } from './app.component'; | 5 | import { AppComponent } from './app.component'; |
6 | import { HeaderComponent } from './header/header.component'; | 6 | import { HeaderComponent } from './header/header.component'; |
7 | import { SidebarComponent } from './sidebar/sidebar.component'; | 7 | import { SidebarComponent } from './sidebar/sidebar.component'; |
8 | import { CarouselComponent } from './carousel/carousel.component'; | 8 | import { CarouselComponent } from './carousel/carousel.component'; |
9 | import { HomeComponent } from './home/home.component'; | 9 | import { HomeComponent } from './home/home.component'; |
10 | import { CargarProductosComponent } from './cargar-productos/cargar-productos.component'; | ||
10 | 11 | ||
11 | @NgModule({ | 12 | @NgModule({ |
12 | declarations: [ | 13 | declarations: [ |
13 | AppComponent, | 14 | AppComponent, |
14 | HeaderComponent, | 15 | HeaderComponent, |
15 | SidebarComponent, | 16 | SidebarComponent, |
16 | CarouselComponent, | 17 | CarouselComponent, |
17 | HomeComponent | 18 | HomeComponent, |
19 | CargarProductosComponent | ||
18 | ], | 20 | ], |
19 | imports: [ | 21 | imports: [ |
20 | BrowserModule, | 22 | BrowserModule, |
21 | AppRoutingModule | 23 | AppRoutingModule |
22 | ], | 24 | ], |
23 | providers: [], | 25 | providers: [], |
24 | bootstrap: [AppComponent] | 26 | bootstrap: [AppComponent] |
25 | }) | 27 | }) |
26 | export class AppModule { } | 28 | export class AppModule { } |
27 | 29 |
src/app/home/home.component.html
1 | <!-- HEADER --> | 1 | <div class="container-fluid h-100"> |
2 | <div class="bg-dark py-1 py-sm-2 py-lg-5 w-100"> | 2 | <div class="row h-100"> |
3 | <p class="text-white text-center">HEADER</p> | 3 | <div class="col p-0"> |
4 | </div> | 4 | <div class="w-100 h-100 d-flex align-items-start flex-column disable-user-select"> |
5 | |||
6 | <!-- HEADER --> | ||
7 | <div class="bg-dark py-1 py-sm-2 py-lg-5 w-100"> | ||
8 | <p class="text-white text-center">HEADER</p> | ||
9 | </div> | ||
5 | 10 | ||
6 | <div class="h-100 w-100 position-relative"> | 11 | <div class="h-100 w-100 position-relative"> |
7 | <div class="background-image blur"></div> | 12 | <div class="background-image blur"></div> |
8 | <div class="row position-absolute w-100 h-100"> | 13 | <div class="row position-absolute w-100 h-100"> |
9 | <div class="col-5 my-auto"> | 14 | <div class="col-5 my-auto"> |
10 | <!-- CAROUSEL --> | 15 | <!-- CAROUSEL --> |
11 | <div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel"> | 16 | <div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel"> |
12 | <div class="carousel-inner"> | 17 | <div class="carousel-inner"> |
13 | <div class="carousel-item active"> | 18 | <div class="carousel-item active"> |
14 | <img class="m-auto img-fluid d-block w-75" | 19 | <img class="m-auto img-fluid d-block w-75" |
15 | src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQWhHnLeoxWeJeiBKvVg-9zDzppOVX_AY5tXpRuS7If0mzb_01b" | 20 | src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQWhHnLeoxWeJeiBKvVg-9zDzppOVX_AY5tXpRuS7If0mzb_01b" |
16 | alt=""> | 21 | alt=""> |
17 | </div> | 22 | </div> |
18 | <div class="carousel-item"> | 23 | <div class="carousel-item"> |
19 | <img class="m-auto img-fluid d-block w-75" | 24 | <img class="m-auto img-fluid d-block w-75" |
20 | src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQWhHnLeoxWeJeiBKvVg-9zDzppOVX_AY5tXpRuS7If0mzb_01b" | 25 | src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQWhHnLeoxWeJeiBKvVg-9zDzppOVX_AY5tXpRuS7If0mzb_01b" |
21 | alt=""> | 26 | alt=""> |
27 | </div> | ||
28 | </div> | ||
29 | </div> | ||
30 | </div> | ||
31 | <div class="col-7 my-auto"> | ||
32 | <div class="text-center text-white"> | ||
33 | <h1 class="display-2 font-weight-bold">¡BIENVENIDO!</h1> | ||
34 | <h1 class="display-3 font-weight-bold">Toque la pantalla<br>para comenzar.</h1> | ||
35 | </div> | ||
36 | </div> | ||
22 | </div> | 37 | </div> |
23 | </div> | 38 | </div> |
24 | </div> | 39 | |
25 | </div> | 40 | <!-- FOOTER --> |
26 | <div class="col-7 my-auto"> | 41 | <div class="bg-dark py-1 py-sm-2 py-lg-5 w-100"> |
27 | <div class="text-center text-white"> | 42 | <p class="text-white text-center">FOOTER</p> |
28 | <h1 class="display-2 font-weight-bold">¡BIENVENIDO!</h1> | 43 | </div> |
29 | <h1 class="display-3 font-weight-bold">Toque la pantalla<br>para comenzar.</h1> | ||
30 | </div> | 44 | </div> |
31 | </div> | 45 | </div> |
32 | </div> | 46 | </div> |
src/app/home/home.component.ts
1 | import { Component, OnInit } from '@angular/core'; | 1 | import { Component, OnInit, HostListener } from '@angular/core'; |
2 | import { Router } from '@angular/router'; | ||
2 | 3 | ||
3 | @Component({ | 4 | @Component({ |
4 | selector: 'app-home', | 5 | selector: 'app-home', |
5 | templateUrl: './home.component.html', | 6 | templateUrl: './home.component.html', |
6 | styleUrls: ['./home.component.scss'] | 7 | styleUrls: ['./home.component.scss'] |
7 | }) | 8 | }) |
8 | export class HomeComponent implements OnInit { | 9 | export class HomeComponent implements OnInit { |
9 | 10 | ||
10 | constructor() { } | 11 | constructor(private router: Router) { } |
11 | 12 | ||
12 | ngOnInit() { | 13 | ngOnInit() { |
13 | } | 14 | } |
14 | 15 | ||
16 | @HostListener('document:click', ['$event']) | ||
17 | documentClick(event: MouseEvent) { | ||
18 | this.router.navigate(['/cargar-productos']); | ||
19 | } | ||
20 | |||
15 | } | 21 | } |
16 | 22 |
src/app/sidebar/sidebar.component.html
1 | < <div class="d-flex align-items-center flex-column h-100 bg-dark pt-2 text-center"> | 1 | <div class="d-flex align-items-center flex-column h-100 bg-dark pt-2 text-center"> |
2 | 2 | ||
3 | <h4 class="border-bottom border-white"> Mi compra </h4> | 3 | <h4 class="border-bottom border-white"> Mi compra </h4> |
4 | 4 | ||
5 | <div class="card mt-2 bg-primary"> | 5 | <div class="card mt-2 bg-primary"> |
6 | <img src="../../assets/descarga.jpg" class="card-img-top" alt="..."> | 6 | <img src="../../assets/descarga.jpg" class="card-img-top" alt="..."> |
7 | <div class="card-body row m-0 p-0 px-1 py-1 shadow rounded"> | 7 | <div class="card-body row m-0 p-0 px-1 py-1 shadow rounded"> |
8 | <div class="col-8 p-0 text-left my-auto"> | 8 | <div class="col-8 p-0 text-left my-auto"> |
9 | <p class="m-0 card-description">Galleta oreo x 199 gs Chocolate</p> | 9 | <p class="m-0 card-description">Galleta oreo x 199 gs Chocolate</p> |
10 | <p class="m-0 card-description"><small>COD: 1234567</small></p> | 10 | <p class="m-0 card-description"><small>COD: 1234567</small></p> |
11 | </div> | 11 | </div> |
12 | <div class="col-4 p-1 text-center my-auto"> | 12 | <div class="col-4 p-1 text-center my-auto"> |
13 | {{90 | currency}} | 13 | {{90 | currency}} |
14 | </div> | 14 | </div> |
15 | </div> | 15 | </div> |
16 | <div class="row m-0 p-0"> | 16 | <div class="row m-0 p-0"> |
17 | <div class="col p-1 pb-1 mt-2"> | 17 | <div class="col p-1 pb-1 mt-2"> |
18 | <button type="button" class="btn btn-light btn-sm float-left my-auto">X</button> | 18 | <button type="button" class="btn btn-light btn-sm float-left my-auto">X</button> |
19 | <button type="button" class="btn btn-light btn-sm my-auto">X</button> | 19 | <button type="button" class="btn btn-light btn-sm my-auto">X</button> |
20 | <div class="btn-group-sm btn-group float-right my-auto" role="group" aria-label="Basic example"> | 20 | <div class="btn-group-sm btn-group float-right my-auto" role="group" aria-label="Basic example"> |
21 | <button type="button" class="btn btn-light btn-sm mb-2">+</button> | 21 | <button type="button" class="btn btn-light btn-sm mb-2">+</button> |
22 | <label for="" class="border border.white px-1">12</label> | 22 | <label for="" class="border border.white px-1">12</label> |
23 | <button type="button" class="btn btn-light btn-sm mb-2">-</button> | 23 | <button type="button" class="btn btn-light btn-sm mb-2">-</button> |
24 | </div> | 24 | </div> |
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | </div> | 27 | </div> |
28 | 28 | ||
29 | <div class="card mt-auto blue-gradient"> | 29 | <div class="card mt-auto blue-gradient"> |
30 | <div class="card-body row"> | 30 | <div class="card-body row"> |
31 | <div class="col"> | 31 | <div class="col"> |
32 | <h4 class="border-bottom border-secondary text-secondary">(1) item</h4> | 32 | <h4 class="border-bottom border-secondary text-secondary">(1) item</h4> |
33 | <h3 class="text-secondary">Total</h3> | 33 | <h3 class="text-secondary">Total</h3> |
34 | <h3 class="text-dark"><strong>{{5000 | currency}}</strong></h3> | 34 | <h3 class="text-dark"><strong>{{5000 | currency}}</strong></h3> |
35 | </div> | 35 | </div> |
36 | <div class="col 12 p-0"> | 36 | <div class="col 12 p-0"> |
37 | <button type="button" class="btn btn-light shadow mb-2"><strong>Finalizar y pagar</strong></button> | 37 | <button type="button" class="btn btn-light shadow mb-2"><strong>Finalizar y pagar</strong></button> |
38 | <button type="button" class="btn btn-light shadow btn-sm">Cancelar</button> | 38 | <button type="button" class="btn btn-light shadow btn-sm">Cancelar</button> |
39 | </div> | 39 | </div> |
40 | </div> | 40 | </div> |
41 | </div> | 41 | </div> |
42 | </div> |