Skip to content

Commit

Permalink
feat(home): Separate recipes and home modules (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaogarin authored Nov 12, 2017
1 parent 901a539 commit 7d5046c
Show file tree
Hide file tree
Showing 70 changed files with 850 additions and 227 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import "./../styles/settings/breakpoints.scss";
@import "./../styles/settings/layout.scss";

@import "./../styles/settings/colors.scss";
.main-content {
padding: {
top: 0;
Expand Down
13 changes: 2 additions & 11 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { SharedModule } from './shared/shared.module';
import { HttpModule } from '@angular/http';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { RouterTestingModule } from '@angular/router/testing';
import { MatButtonModule, MatIconModule, MatIconRegistry, MatListModule, MatSidenavModule, MatToolbarModule } from '@angular/material';

import { AppComponent } from './app.component';
import { SidenavComponent } from './components/sidenav/sidenav.component';
Expand All @@ -25,17 +25,8 @@ describe('AppComponent', () => {
SidenavComponent
],
imports: [
MatToolbarModule,
MatButtonModule,
MatSidenavModule,
MatIconModule,
HttpModule,
MatListModule,
SharedModule.forRoot(),
RouterTestingModule.withRoutes([])
],
providers: [
MatIconRegistry,
MaterialIconsService
]
}).compileComponents();
}));
Expand Down
1 change: 1 addition & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class AppComponent implements OnInit {
@ViewChild('sidenav') sidenav: MatSidenav;
menu: Array<Object> = [
{ name: 'Home', url: '', icon: 'home' },
{ name: 'Recipes', url: './recipes', icon: 'settings' },
{ name: 'Features', url: './features', icon: 'settings' }
];

Expand Down
68 changes: 7 additions & 61 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,7 @@
import { SharedModule } from './shared/shared.module';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import {
MatButtonModule,
MatCardModule,
MatCheckboxModule,
MatChipsModule,
MatIconModule,
MatIconRegistry,
MatInputModule,
MatListModule,
MatOptionModule,
MatProgressSpinnerModule,
MatSelectModule,
MatSidenavModule,
MatToolbarModule
} from '@angular/material';
import 'hammerjs';

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
Expand All @@ -29,80 +12,43 @@ import { StoreRouterConnectingModule } from '@ngrx/router-store';
import { AppComponent } from './app.component';
import { HeaderComponent } from './components/header/header.component';
import { SidenavComponent } from './components/sidenav/sidenav.component';
import { RecipesAndFiltersComponent } from './components/recipes-and-filters/recipes-and-filters.component';
import { RecipesComponent } from './components/recipes/recipes.component';
import { RecipeDetailsComponent } from './components/recipe-details/recipe-details.component';
import { RecipeComponent } from './components/recipe/recipe.component';
import { FiltersComponent } from './components/filters/filters.component';
import { CardComponent } from './components/card/card.component';
import { FeaturesComponent } from './components/features/features.component';
import { environment } from './../environments/environment';

import { Backend } from './services/backend.service';
import { MaterialIconsService } from './services/material-icons/material-icons.service';
import { appReducer } from './store/reducers/reducers';
import { RecipesEffects } from './store/effects/effects';
import { initialState } from './models/state.model';

import { BASE_URL, ContentaDatastore, ContentaServiceModule } from 'contenta-angular-service';
import { TagCloudComponent } from './components/tag-cloud/tag-cloud.component';

import { InfiniteScrollModule } from 'ngx-infinite-scroll';

@NgModule({
declarations: [
AppComponent,
CardComponent,
FeaturesComponent,
HeaderComponent,
SidenavComponent,
RecipesAndFiltersComponent,
RecipesComponent,
RecipeDetailsComponent,
RecipeComponent,
FiltersComponent,
TagCloudComponent
SidenavComponent
],
imports: [
BrowserModule,
ReactiveFormsModule,
HttpModule,
HttpClientModule,
ContentaServiceModule,
BrowserAnimationsModule,
MatInputModule,
MatCheckboxModule,
MatToolbarModule,
MatButtonModule,
MatSidenavModule,
MatChipsModule,
MatIconModule,
MatListModule,
MatOptionModule,
MatSelectModule,
MatProgressSpinnerModule,
MatCardModule,
InfiniteScrollModule,
ContentaServiceModule,
SharedModule.forRoot(),
RouterModule.forRoot([
{ path: '', pathMatch: 'full', redirectTo: 'recipes' },
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'features', component: FeaturesComponent },
{ path: 'recipes', pathMatch: 'full', component: RecipesAndFiltersComponent },
{ path: 'recipe/:id', component: RecipeDetailsComponent }
{ path: 'home', loadChildren: './home/home.module#HomeModule' },
{ path: 'recipes', loadChildren: './recipes/recipes.module#RecipesModule' }
]),

StoreModule.forRoot(<any>{ app: appReducer }, { initialState }),

EffectsModule.forRoot([
RecipesEffects
]),

StoreRouterConnectingModule
],
providers: [
Backend,
RecipesEffects,
MatIconRegistry,
MaterialIconsService,
ContentaDatastore,
{
provide: BASE_URL,
Expand Down
25 changes: 0 additions & 25 deletions src/app/components/card/card.component.scss

This file was deleted.

7 changes: 7 additions & 0 deletions src/app/components/header/_header-custom-theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Custom mixin for the themed parts of this component.
@mixin header-custom-theme($theme) {
$background: map-get($theme, "background");
.header-toolbar {
background-color: mat-color($background, "card");
}
}
4 changes: 2 additions & 2 deletions src/app/components/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<mat-toolbar class="mat-elevation-z6" [color]="'primary'">
<mat-toolbar class="header-toolbar mat-elevation-z6">
<button class="sidenav-toggle" aria-label="Toggle Sidebar" (click)="toggleSidenav()">
<mat-icon class="menu-icon" [svgIcon]="'sort'"></mat-icon>
</button>
Expand All @@ -7,6 +7,6 @@
<a [routerLink]="''" mat-button><mat-icon [svgIcon]="'umami-logo'"></mat-icon><span class="app-title">{{ title }}</span></a>
<span class="spacer"></span>
<a *ngFor="let menu_item of menu; let i = index" class="menu-item" mat-button [routerLink]="[menu_item.url]">{{ menu_item.name }}</a>
<a href="https://github.com/contentacms/contenta_angular" target="_blank" rel="noopener" mat-button class="github-logo"><img class="logo" src="/assets/github.png" alt="Github" title="Github"/>Github</a>
<a href="https://github.com/contentacms/contenta_angular" target="_blank" rel="noopener" mat-button class="menu-item">Github</a>
</div>
</mat-toolbar>
5 changes: 1 addition & 4 deletions src/app/components/header/header.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
.app-title {
font-size: 13px;
text-transform: uppercase;
color: white;
@include breakpoint($narrow-devices) {
display: none;
}
Expand All @@ -35,9 +34,7 @@
}
}

.menu-icon {
color: white;
}
.menu-icon {}

.github-logo {
img {
Expand Down
17 changes: 5 additions & 12 deletions src/app/components/header/header.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SharedModule } from './../../shared/shared.module';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
Expand All @@ -6,9 +7,7 @@ import { RouterTestingModule } from '@angular/router/testing';
/**
* Test dependencies.
*/
import { HttpModule } from '@angular/http';
import { MatButtonModule, MatIconModule, MatIconRegistry, MatListModule, MatSidenavModule, MatToolbarModule } from '@angular/material';
import { MaterialIconsService } from './../../services/material-icons/material-icons.service';
import { HttpModule } from '@angular/http'; ;
import { HeaderComponent } from './header.component';

describe('HeaderComponent', () => {
Expand All @@ -20,15 +19,9 @@ describe('HeaderComponent', () => {
TestBed.configureTestingModule({
declarations: [HeaderComponent],
imports: [
MatToolbarModule,
MatButtonModule,
MatIconModule,
SharedModule.forRoot(),
HttpModule,
RouterTestingModule.withRoutes([])
],
providers: [
MatIconRegistry,
MaterialIconsService
]
})
.compileComponents();
Expand Down Expand Up @@ -63,8 +56,8 @@ describe('HeaderComponent', () => {
expect(component.toggleSidebar.emit).toHaveBeenCalled();
});

it('should render as much menu items as passed through input', () => {
it('should render as much menu items as passed through input + github link', () => {
const elm = element.queryAll(By.css('.menu-item'));
expect(elm.length).toBe(2);
expect(elm.length).toBe(3);
});
});
51 changes: 0 additions & 51 deletions src/app/components/recipe-details/recipe-details.component.html

This file was deleted.

13 changes: 2 additions & 11 deletions src/app/components/sidenav/sidenav.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SharedModule } from './../../shared/shared.module';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
Expand All @@ -7,8 +8,6 @@ import { RouterTestingModule } from '@angular/router/testing';
* Test dependencies.
*/
import { HttpModule } from '@angular/http';
import { MatButtonModule, MatIconModule, MatIconRegistry, MatListModule, MatSidenavModule, MatToolbarModule } from '@angular/material';
import { MaterialIconsService } from './../../services/material-icons/material-icons.service';
import { SidenavComponent } from './sidenav.component';

describe('SidenavComponent', () => {
Expand All @@ -20,17 +19,9 @@ describe('SidenavComponent', () => {
TestBed.configureTestingModule({
declarations: [SidenavComponent],
imports: [
MatToolbarModule,
MatButtonModule,
MatSidenavModule,
MatIconModule,
SharedModule.forRoot(),
HttpModule,
MatListModule,
RouterTestingModule.withRoutes([])
],
providers: [
MatIconRegistry,
MaterialIconsService
]
})
.compileComponents();
Expand Down
40 changes: 40 additions & 0 deletions src/app/home/components/home-banner/home-banner.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div class="home-banner-section">
<div class="home-banner__inner maxed-width">
<div class="magazine">
<img src="assets/magazine.png" alt="Umami magazine" title="Umami" />
</div>
<div class="cta-text">
<h2>
In this months issue
</h2>
<h3>
Lorem Ipsum is simply dummy text of the printing
<br/> and typesetting industry.
</h3>
<div class="home-banner__bullets">
<ul>
<li>
Comforting Winter puddins
</li>
<li>
Introduction to Iceland food
</li>
<li>
15 Healthy Meals under 500 Callories
</li>
<li>
Winter warmers
</li>
<li>
Are all sugards the same?
</li>
<li>
Profile on head chef Jeremy Watson
</li>
</ul>
</div>
<br/>
<button color="primary" mat-raised-button>More Umami</button>
</div>
</div>
</div>
Loading

0 comments on commit 7d5046c

Please sign in to comment.