Skip to content

Commit cf29e25

Browse files
committed
Modularize the cart layer
1 parent b398e75 commit cf29e25

File tree

8 files changed

+24
-7
lines changed

8 files changed

+24
-7
lines changed

src/app/app.module.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,14 @@ import {
4545
ScrollHooks,
4646
} from 'ng-lazyload-image';
4747
import { ClickStopPropagation } from './shared/click-stop-propagation.directive';
48-
import { CartLayerItemComponent } from './components/cart-layer-item/cart-layer-item.component';
49-
import { CartLayerContentsComponent } from './components/cart-layer-contents/cart-layer-contents.component';
5048
import { MenuLayerContentComponent } from './components/top-bar/menu-layer-content/menu-layer-content.component';
5149
import { MenuLayerTitleComponent } from './components/top-bar/menu-layer-title/menu-layer-title.component';
5250
import { HoverColorPickerDirective } from './directives/hover-color-picker-directive.service';
5351
import { GraphQLModule } from './graphql.module';
5452
import { ProductsModule } from './features/products/products.module';
5553
import { SharedModule } from './shared/shared.module';
5654
import { CheckoutModule } from './features/checkout/checkout.module';
55+
import { CartModule } from './cart/cart.module';
5756

5857
export function HttpLoaderFactory(http: HttpClient) {
5958
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
@@ -85,8 +84,6 @@ const vclModules = [
8584
FooterTopComponent,
8685
HeaderComponent,
8786
ClickStopPropagation,
88-
CartLayerItemComponent,
89-
CartLayerContentsComponent,
9087
MenuLayerContentComponent,
9188
MenuLayerTitleComponent,
9289
CookiePreferenceComponent,
@@ -97,6 +94,7 @@ const vclModules = [
9794
BrowserAnimationsModule,
9895
ProductsModule,
9996
CheckoutModule,
97+
CartModule,
10098
AppRoutingModule,
10199
HttpClientModule,
102100
LazyLoadImageModule,

src/app/cart/cart.module.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { CartLayerItemComponent } from './components/cart-layer-item/cart-layer-item.component';
4+
import { CartLayerContentsComponent } from './components/cart-layer-contents/cart-layer-contents.component';
5+
import { SharedModule } from '../shared/shared.module';
6+
import {
7+
VCLFormControlGroupModule,
8+
VCLInputModule,
9+
VCLSelectModule,
10+
} from '@vcl/ng-vcl';
11+
12+
const components = [CartLayerContentsComponent, CartLayerItemComponent];
13+
14+
const vclModules = [VCLInputModule, VCLSelectModule, VCLFormControlGroupModule];
15+
16+
@NgModule({
17+
declarations: [...components],
18+
imports: [CommonModule, SharedModule, ...vclModules],
19+
exports: [...components],
20+
})
21+
export class CartModule {}

src/app/components/cart-layer-item/cart-layer-item.component.ts renamed to src/app/cart/components/cart-layer-item/cart-layer-item.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import { CartService } from 'src/app/services/cart.service';
66
templateUrl: './cart-layer-item.component.html',
77
styleUrls: ['./cart-layer-item.component.scss'],
88
})
9-
export class CartLayerItemComponent implements OnInit {
9+
export class CartLayerItemComponent {
1010
constructor(public cartService: CartService) {}
1111

1212
@Input() cartItem: any;
13-
14-
ngOnInit(): void {}
1513
}

0 commit comments

Comments
 (0)