Skip to content
This repository was archived by the owner on Nov 19, 2021. It is now read-only.

Commit a08e58e

Browse files
committed
Created card component
1 parent 6e64da7 commit a08e58e

24 files changed

+81
-31
lines changed

src/app/app.module.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { routedComponents, AppRoutingModule } from './app-routing.module';
1515

1616
import { SharedModule } from './shared/shared.module';
1717
import { ImageViewComponent } from './image-view/image-view.component';
18-
import { CartComponent } from './cart/cart.component';
18+
import { CardComponent } from './card/card.component';
1919

2020
const httpInterceptorProviders: Type<any>[] = [
2121
RequestInterceptor,
@@ -26,8 +26,8 @@ const httpInterceptorProviders: Type<any>[] = [
2626
AppComponent,
2727
routedComponents,
2828
ImageViewComponent,
29-
CartComponent,
3029
DashboardComponent,
30+
CardComponent,
3131
], // directives, components, and pipes owned by this NgModule
3232
imports: [
3333
AppRoutingModule,

src/app/card/card.component.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<div layout-gt-sm="row" tdMediaToggle="gt-xs" [mediaClasses]="['push-sm']">
2+
<div flex-gt-sm="column.columnSize" *ngFor="let column of images">
3+
<md-card *ngFor="let image of column.column">
4+
<img class="img" md-card-image (click)="clickedImage(image.url)" [class.biggerImg]="image.isclicked" [src]=image.url>
5+
<md-card-actions>
6+
<div layout="row" class="tc-grey-600">
7+
<button md-icon-button mdTooltip="Like"><md-icon>favorite</md-icon></button>
8+
<button md-icon-button mdTooltip="Comment"><md-icon>comment</md-icon></button>
9+
<button md-icon-button mdTooltip="Add to cart" (click)="clickedAddToCart(image)">
10+
<md-icon>add_shopping_cart</md-icon></button>
11+
<span flex></span>
12+
<button md-icon-button mdTooltip="Share"><md-icon>share</md-icon></button>
13+
</div>
14+
</md-card-actions>
15+
</md-card>
16+
</div>
17+
</div>

src/app/card/card.component.scss

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.md-icon-ux {
2+
width: 100px;
3+
}
4+
5+
.icon {
6+
font-size: 48px;
7+
}
8+
9+
.chart-height {
10+
height: 300px;
11+
}
12+
13+
.img {
14+
cursor: zoom-in;
15+
}
16+
17+
.biggerImg {
18+
padding: 1000px;
19+
}

src/app/cart/cart.component.spec.ts src/app/card/card.component.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22

3-
import { CartComponent } from './cart.component';
3+
import { CardComponent } from './card.component';
44

5-
describe('CartComponent', () => {
6-
let component: CartComponent;
7-
let fixture: ComponentFixture<CartComponent>;
5+
describe('CardComponent', () => {
6+
let component: CardComponent;
7+
let fixture: ComponentFixture<CardComponent>;
88

99
beforeEach(async(() => {
1010
TestBed.configureTestingModule({
11-
declarations: [ CartComponent ]
11+
declarations: [ CardComponent ]
1212
})
1313
.compileComponents();
1414
}));
1515

1616
beforeEach(() => {
17-
fixture = TestBed.createComponent(CartComponent);
17+
fixture = TestBed.createComponent(CardComponent);
1818
component = fixture.componentInstance;
1919
fixture.detectChanges();
2020
});

src/app/card/card.component.ts

+15
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-card',
5+
templateUrl: './card.component.html',
6+
styleUrls: ['./card.component.scss']
7+
})
8+
export class CardComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit() {
13+
}
14+
15+
}

src/app/cart.service.ts

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export class CartService {
2424
duration: duration,
2525
extraClasses: ['bgc-' + color + '-600'],
2626
});
27-
2827
item = { name: image.name, url: image.url, count: image.count };
2928
let result: boolean = this.isRepeated(item, items);
3029
if (!(result)) {

src/app/cart/cart.component.html

-3
This file was deleted.

src/app/cart/cart.component.scss

Whitespace-only changes.

src/app/cart/cart.component.ts

-15
This file was deleted.

src/app/dashboard/dashboard.component.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@
1717
<h4 md-line>
1818
<span class="text-wrap">{{item.name}}</span>
1919
<span class="x-number">x{{item.count}}</span>
20-
</h4>
20+
</h4>
2121
</a>
22-
<md-divider *ngIf="!last"></md-divider>
2322
</md-nav-list>
2423
<button md-button color="accent" td-menu-footer>
25-
See All products
24+
Close
2625
</button>
2726
</td-menu>
2827
</md-menu>

src/app/dashboard/dashboard.component.scss

-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@
2727
}
2828

2929
.x-number {
30-
3130
color: #EF6C00;
3231
}
-1.26 MB
Loading
-1.09 MB
Loading
-574 KB
Loading
-1.07 MB
Loading
-992 KB
Loading
-2.2 MB
Loading
-903 KB
Loading
-1000 KB
Loading
-963 KB
Loading
-1.82 MB
Loading
-703 KB
Loading
-1.66 MB
Loading

tsconfig.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"outDir": "./dist/out-tsc",
5+
"baseUrl": "src",
6+
"sourceMap": true,
7+
"declaration": false,
8+
"moduleResolution": "node",
9+
"emitDecoratorMetadata": true,
10+
"experimentalDecorators": true,
11+
"target": "es5",
12+
"typeRoots": [
13+
"node_modules/@types"
14+
],
15+
"lib": [
16+
"es2016",
17+
"dom"
18+
]
19+
}
20+
}

0 commit comments

Comments
 (0)