Compare commits
4 Commits
1d2178808b
...
2185068dce
Author | SHA1 | Date |
---|---|---|
Vic | 2185068dce | 2 years ago |
Vic | 8d75bdfc45 | 2 years ago |
Vic | b5b0aba3fe | 2 years ago |
Vic | 136ea4ff87 | 2 years ago |
@ -0,0 +1,21 @@
|
||||
<div class="cart-container">
|
||||
<div class="cart-list-items">
|
||||
<div class="cart-item">
|
||||
<div class="cart-item-img">
|
||||
<p>img</p>
|
||||
</div>
|
||||
<div class="cart-item-details">
|
||||
<p>name</p>
|
||||
<p>price</p>
|
||||
<p>quantity</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cart-payment-from">
|
||||
<p>Fullname input</p>
|
||||
<p>Address input</p>
|
||||
<p>Credit Card Number</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -0,0 +1,49 @@
|
||||
$small: 600px;
|
||||
$medium: 960px;
|
||||
|
||||
|
||||
.cart-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding-top: 30vh;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
|
||||
.cart-list-items {
|
||||
padding-right: 12vh
|
||||
}
|
||||
|
||||
.cart-item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-right: 10%;
|
||||
height: 12vh;
|
||||
width: 20vh;
|
||||
padding: 10%;
|
||||
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);
|
||||
}
|
||||
|
||||
.cart-item-img {
|
||||
padding-right: 20%;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.cart-payment-from {
|
||||
height: 12vh;
|
||||
padding: 4vh;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CartComponent } from './cart.component';
|
||||
|
||||
describe('CartComponent', () => {
|
||||
let component: CartComponent;
|
||||
let fixture: ComponentFixture<CartComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CartComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CartComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cart',
|
||||
templateUrl: './cart.component.html',
|
||||
styleUrls: ['./cart.component.scss']
|
||||
})
|
||||
export class CartComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,3 @@
|
||||
<app-navbar></app-navbar>
|
||||
<div class="body-container">
|
||||
<app-product-list></app-product-list>
|
||||
</div>
|
@ -1,5 +1,15 @@
|
||||
$small: 600px;
|
||||
$medium: 960px;
|
||||
|
||||
.body-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding-top: 5%;
|
||||
padding-top: 10%;
|
||||
@media screen and (max-width: $medium) {
|
||||
padding-top: 15%;
|
||||
padding-bottom: 15%;
|
||||
}
|
||||
@media screen and (max-width: $small) {
|
||||
padding-top: 25%;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CartService } from './cart.service';
|
||||
|
||||
describe('CartService', () => {
|
||||
let service: CartService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(CartService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,25 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Product } from '../models/product';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CartService {
|
||||
items: Product[] = []
|
||||
|
||||
constructor() { }
|
||||
|
||||
addToCart(product: Product) {
|
||||
this.items.push(product)
|
||||
}
|
||||
|
||||
getItems() {
|
||||
return this.items
|
||||
}
|
||||
|
||||
clearCart() {
|
||||
this.items = []
|
||||
return this.items
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue