Compare commits
2 Commits
d54315fe87
...
e768a5fdb4
Author | SHA1 | Date |
---|---|---|
Vic | e768a5fdb4 | 2 years ago |
Vic | 7eca3cbd8a | 2 years ago |
@ -1,3 +1,14 @@
|
||||
.navbar {
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.nav-spacer {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<app-navbar></app-navbar>
|
||||
<div class="details-container">
|
||||
<div class="details-img">
|
||||
<img src={{product.url}} class="card-img">
|
||||
</div>
|
||||
<div class="details-info">
|
||||
<label class="info-tilte">{{product.name}}</label>
|
||||
<label class="info-price">{{product.price}} $</label>
|
||||
<label class="info-description">{{product.description}}</label>
|
||||
<mat-form-field appearance="fill" class="details-quantity">
|
||||
<mat-label>Quantity</mat-label>
|
||||
<mat-select>
|
||||
<mat-option value="option1">1</mat-option>
|
||||
<mat-option value="option2">2</mat-option>
|
||||
<mat-option value="option3">3</mat-option>
|
||||
<mat-option value="option3">4</mat-option>
|
||||
<mat-option value="option3">5</mat-option>
|
||||
<mat-option value="option3">6</mat-option>
|
||||
<mat-option value="option3">7</mat-option>
|
||||
<mat-option value="option3">8</mat-option>
|
||||
<mat-option value="option3">9</mat-option>
|
||||
<mat-option value="option3">10</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<div class="details-buttons">
|
||||
<button mat-raised-button color="primary" routerLink="/" class="back-button">Back</button>
|
||||
<button mat-raised-button color="primary">Add to cart</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,82 @@
|
||||
.details-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding-top: 10%;
|
||||
|
||||
}
|
||||
|
||||
.details-img {
|
||||
width: 25%;
|
||||
padding-right: 5%;
|
||||
height:50vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.details-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 2%;
|
||||
padding-top: 2%;
|
||||
width: 30%;
|
||||
box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2),0px 1px 1px 0px rgba(0, 0, 0, 0.14),0px 1px 3px 0px rgba(0, 0, 0, 0.12);
|
||||
transition: box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.info-tilte {
|
||||
font-size: 4vh;
|
||||
padding-bottom: 2%;
|
||||
}
|
||||
|
||||
.info-price {
|
||||
font-size: 2.5vh;
|
||||
}
|
||||
|
||||
.info-description {
|
||||
padding-top: 10%;
|
||||
}
|
||||
|
||||
.details-quantity {
|
||||
width: 30%;
|
||||
padding-top: 5%;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.back-button {
|
||||
margin-right: 5%;
|
||||
}
|
||||
|
||||
img {
|
||||
border-radius: 10px;
|
||||
box-shadow: 0px 2px 1px -1px rgba(0, 0, 0, 0.2),0px 1px 1px 0px rgba(0, 0, 0, 0.14),0px 1px 3px 0px rgba(0, 0, 0, 0.12);
|
||||
transition: box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
|
||||
width: 100%;
|
||||
height: auto;
|
||||
position: relative;
|
||||
top: 50%;
|
||||
-ms-transform: translateY(-50%);
|
||||
-webkit-transform: translateY(-50%);
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
@media screen and (max-width:800px) {
|
||||
.details-img > img {
|
||||
min-width:650px;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translatex(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.select-input {
|
||||
width: 108px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
margin-left: 128px;
|
||||
margin-right: 128px;
|
||||
}
|
||||
|
||||
.back-link {
|
||||
margin-top: 8px;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProductItemDetailsComponent } from './product-item-details.component';
|
||||
|
||||
describe('ProductItemDetailsComponent', () => {
|
||||
let component: ProductItemDetailsComponent;
|
||||
let fixture: ComponentFixture<ProductItemDetailsComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ProductItemDetailsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ProductItemDetailsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,36 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Product } from '../../models/product';
|
||||
import { ActivatedRoute } from "@angular/router"
|
||||
import { HttpService } from 'src/app/services/http.service';
|
||||
import { FormControl } from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'app-product-item-details',
|
||||
templateUrl: './product-item-details.component.html',
|
||||
styleUrls: ['./product-item-details.component.scss']
|
||||
})
|
||||
export class ProductItemDetailsComponent implements OnInit {
|
||||
disableSelect = new FormControl(false);
|
||||
product: Product =
|
||||
{
|
||||
id: 1,
|
||||
name: "",
|
||||
price: 0,
|
||||
url: "",
|
||||
description: ""
|
||||
}
|
||||
productId: number = 0
|
||||
|
||||
constructor(private httpService: HttpService, private route: ActivatedRoute ) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.productId = parseInt(this.route.snapshot.paramMap.get('id') as string, 10);
|
||||
|
||||
this.httpService.getProducts().subscribe((res: Product[]) => {
|
||||
this.product = res.filter(item => item.id === this.productId)[0];
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue