Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1a046e6

Browse files
committed
Split ui components, smart components and pages
1 parent 5811adb commit 1a046e6

File tree

142 files changed

+887
-1180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+887
-1180
lines changed

documentation.json

Lines changed: 793 additions & 649 deletions
Large diffs are not rendered by default.

src/app/app.component.html

Lines changed: 1 addition & 484 deletions
Large diffs are not rendered by default.

src/app/app.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { BrowserModule } from '@angular/platform-browser';
33

44
import { AppRoutingModule } from './app-routing.module';
55
import { AppComponent } from './app.component';
6+
import { PageProductsModule } from './pages/page-products/page-products.module';
67

78
@NgModule({
89
declarations: [AppComponent],
9-
imports: [BrowserModule, AppRoutingModule],
10+
imports: [BrowserModule, AppRoutingModule, PageProductsModule],
1011
providers: [],
1112
bootstrap: [AppComponent],
1213
})

src/app/pages/page-products/page-products.component.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
<ng-template ovSide>Some side stuff</ng-template>
33
<section main>
44
<h2>Products</h2>
5-
<ov-products-list
6-
[products]="products"
7-
(addToCart)="addProductToCart($event)"
8-
></ov-products-list>
5+
<ov-smart-products-list></ov-smart-products-list>
96
</section>
107
</ov-template-default>
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Meta, moduleMetadata, Story } from '@storybook/angular';
2-
import { ProductDefaultMock } from '../../molecules/product-default/product-default.component.mocks';
3-
import { ProductOutOfStockMock } from '../../molecules/product-out-of-stock/product-out-of-stock.component.mocks';
4-
import { ProductReplacementMock } from '../../molecules/product-replaced/product-replaced.component.mocks';
2+
import { ProductDefaultMock } from '../../ui-components/molecules/product-default/product-default.component.mocks';
3+
import { ProductOutOfStockMock } from '../../ui-components/molecules/product-out-of-stock/product-out-of-stock.component.mocks';
4+
import { ProductReplacementMock } from '../../ui-components/molecules/product-replaced/product-replaced.component.mocks';
55
import { PageProductsComponent } from './page-products.component';
66
import { PageProductsModule } from './page-products.module';
77

@@ -18,17 +18,17 @@ export default {
1818
},
1919
} as Meta;
2020

21+
const products = [
22+
ProductDefaultMock.PRIMARY,
23+
ProductDefaultMock.MIN_CONTENT,
24+
ProductOutOfStockMock.MAX_CONTENT,
25+
ProductReplacementMock.MAX_CONTENT,
26+
ProductDefaultMock.MAX_CONTENT,
27+
];
28+
2129
const Template: Story<PageProductsComponent> = (args) => ({
2230
props: args,
2331
});
2432

2533
export const Primary = Template.bind({});
26-
Primary.args = {
27-
products: [
28-
ProductDefaultMock.PRIMARY,
29-
ProductDefaultMock.MIN_CONTENT,
30-
ProductOutOfStockMock.MAX_CONTENT,
31-
ProductReplacementMock.MAX_CONTENT,
32-
ProductDefaultMock.MAX_CONTENT,
33-
],
34-
};
34+
Primary.args = {};

src/app/pages/page-products/page-products.component.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,11 @@ import {
44
Input,
55
OnInit,
66
} from '@angular/core';
7-
import {
8-
AddToCartEvent,
9-
ProductUnion,
10-
} from '../../organisms/products-list/products-list.component';
117
@Component({
128
selector: 'ov-page-products',
139
templateUrl: './page-products.component.html',
1410
styleUrls: ['./page-products.component.scss'],
1511
})
1612
export class PageProductsComponent implements OnInit {
17-
@Input() products!: ProductUnion[];
18-
1913
ngOnInit(): void {}
20-
21-
addProductToCart({ product, quantity }: AddToCartEvent) {
22-
console.log(`Add ${quantity}x ${product.id} to cart`);
23-
}
2414
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { CommonModule } from '@angular/common';
22
import { NgModule } from '@angular/core';
3-
import { ProductsListModule } from '../../organisms/products-list/products-list.module';
4-
import { TemplateDefaultModule } from '../../templates/template-default/template-default.module';
3+
import { SmartProductsListModule } from '../../smart-components/smart-products-list/smart-products-list.module';
4+
import { TemplateDefaultModule } from '../../ui-components/templates/template-default/template-default.module';
55
import { PageProductsComponent } from './page-products.component';
66

77
@NgModule({
88
declarations: [PageProductsComponent],
9-
imports: [CommonModule, TemplateDefaultModule, ProductsListModule],
9+
imports: [CommonModule, TemplateDefaultModule, SmartProductsListModule],
1010
exports: [PageProductsComponent],
1111
})
1212
export class PageProductsModule {}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<ov-products-list
2+
[products]="products"
3+
(addToCart)="addProductToCart($event)"
4+
></ov-products-list>
File renamed without changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { SmartProductsListComponent } from './smart-products-list.component';
4+
5+
describe('SmartProductsListComponent', () => {
6+
let component: SmartProductsListComponent;
7+
let fixture: ComponentFixture<SmartProductsListComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [ SmartProductsListComponent ]
12+
})
13+
.compileComponents();
14+
});
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(SmartProductsListComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});

0 commit comments

Comments
 (0)