-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(daffio): add packages overview page (#2721)
* feat(daffio): add packages overview page * update styles * fix missing package links * fix test --------- Co-authored-by: Peter Lauck <[email protected]>
- Loading branch information
Showing
17 changed files
with
307 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
apps/daffio/src/app/guides/components/package-cards/package-cards.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<a daff-card color="theme" *ngFor="let package of packagesList" [routerLink]="package.path"> | ||
<div daffCardTitle>{{ package.title }}</div> | ||
<div daffCardContent *ngIf="package.description">{{ package.description }}</div> | ||
</a> |
21 changes: 21 additions & 0 deletions
21
apps/daffio/src/app/guides/components/package-cards/package-cards.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@use 'utilities' as daff; | ||
|
||
:host { | ||
display: grid; | ||
align-items: flex-start; | ||
grid-template-columns: 1fr; | ||
gap: 8px; | ||
|
||
@include daff.breakpoint(tablet) { | ||
grid-template-columns: repeat(2, 1fr); | ||
gap: 16px; | ||
} | ||
|
||
@include daff.breakpoint(big-tablet) { | ||
grid-template-columns: repeat(3, 1fr); | ||
} | ||
|
||
@include daff.breakpoint(small-laptop) { | ||
grid-template-columns: repeat(4, 1fr); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
apps/daffio/src/app/guides/components/package-cards/package-cards.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
waitForAsync, | ||
ComponentFixture, | ||
TestBed, | ||
} from '@angular/core/testing'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
import { DaffioDocsPackageCardsComponent } from './package-cards.component'; | ||
|
||
describe('DaffioDocsPackageCardsComponent', () => { | ||
let component: DaffioDocsPackageCardsComponent; | ||
let fixture: ComponentFixture<DaffioDocsPackageCardsComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
DaffioDocsPackageCardsComponent, | ||
], | ||
imports: [ | ||
RouterTestingModule, | ||
NoopAnimationsModule, | ||
], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DaffioDocsPackageCardsComponent); | ||
component = fixture.componentInstance; | ||
|
||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
apps/daffio/src/app/guides/components/package-cards/package-cards.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
Input, | ||
} from '@angular/core'; | ||
|
||
export interface DaffioPackage { | ||
title: string; | ||
path: string; | ||
description: string; | ||
} | ||
|
||
@Component({ | ||
selector: 'daffio-docs-package-cards', | ||
templateUrl: './package-cards.component.html', | ||
styleUrls: ['./package-cards.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DaffioDocsPackageCardsComponent { | ||
|
||
@Input() packagesList: DaffioPackage[]; | ||
} |
22 changes: 22 additions & 0 deletions
22
apps/daffio/src/app/guides/components/package-cards/package-cards.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
import { DaffCardModule } from '@daffodil/design/card'; | ||
|
||
import { DaffioDocsPackageCardsComponent } from './package-cards.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
DaffioDocsPackageCardsComponent, | ||
], | ||
exports: [ | ||
DaffioDocsPackageCardsComponent, | ||
], | ||
imports: [ | ||
CommonModule, | ||
RouterModule, | ||
DaffCardModule, | ||
], | ||
}) | ||
export class DaffioDocsPackageCardsComponentModule { } |
1 change: 1 addition & 0 deletions
1
apps/daffio/src/app/guides/containers/package-cards/package-cards.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<daffio-docs-package-cards [packagesList]="packagesList$ | async"></daffio-docs-package-cards> |
41 changes: 41 additions & 0 deletions
41
apps/daffio/src/app/guides/containers/package-cards/package-cards.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { | ||
waitForAsync, | ||
ComponentFixture, | ||
TestBed, | ||
} from '@angular/core/testing'; | ||
import { NoopAnimationsModule } from '@angular/platform-browser/animations'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
import { DaffioDocsPackageCardsContainer } from './package-cards.component'; | ||
|
||
describe('DaffioDocsPackageCardsContainer', () => { | ||
let component: DaffioDocsPackageCardsContainer; | ||
let fixture: ComponentFixture<DaffioDocsPackageCardsContainer>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
DaffioDocsPackageCardsContainer, | ||
], | ||
imports: [ | ||
RouterTestingModule, | ||
NoopAnimationsModule, | ||
HttpClientTestingModule, | ||
], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DaffioDocsPackageCardsContainer); | ||
component = fixture.componentInstance; | ||
|
||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
apps/daffio/src/app/guides/containers/package-cards/package-cards.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
OnInit, | ||
} from '@angular/core'; | ||
import { | ||
map, | ||
Observable, | ||
tap, | ||
} from 'rxjs'; | ||
|
||
import { DaffioDoc } from '../../../docs/models/doc'; | ||
import { DaffioGuideList } from '../../../docs/models/guide-list'; | ||
import { DaffioDocsService } from '../../../docs/services/docs.service'; | ||
import { DaffioPackage } from '../../components/package-cards/package-cards.component'; | ||
|
||
@Component({ | ||
selector: 'daffio-docs-package-cards-container', | ||
templateUrl: './package-cards.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DaffioDocsPackageCardsContainer implements OnInit { | ||
|
||
packagesList$: Observable<DaffioPackage[]>; | ||
|
||
constructor( | ||
private docService: DaffioDocsService<DaffioDoc, DaffioGuideList>, | ||
) {} | ||
|
||
ngOnInit() { | ||
this.packagesList$ = this.docService.getGuideList().pipe( | ||
map((guidesTree) => guidesTree.children.map((p) => ({ | ||
title: p.title, | ||
path: `/${p.path || p.children?.[0].path}`, | ||
description: '', | ||
}))), | ||
); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
apps/daffio/src/app/guides/containers/package-cards/package-cards.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
import { DaffCardModule } from '@daffodil/design/card'; | ||
|
||
import { DaffioDocsPackageCardsContainer } from './package-cards.component'; | ||
import { DaffioDocsPackageCardsComponentModule } from '../../components/package-cards/package-cards.module'; | ||
|
||
|
||
@NgModule({ | ||
declarations: [ | ||
DaffioDocsPackageCardsContainer, | ||
], | ||
exports: [ | ||
DaffioDocsPackageCardsContainer, | ||
], | ||
imports: [ | ||
CommonModule, | ||
RouterModule, | ||
DaffCardModule, | ||
DaffioDocsPackageCardsComponentModule, | ||
], | ||
}) | ||
export class DaffioDocsPackageCardsContainerModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule } from '@angular/router'; | ||
|
||
import { DaffContainerModule } from '@daffodil/design/container'; | ||
import { DaffHeroModule } from '@daffodil/design/hero'; | ||
|
||
import { DaffioDocsPackageCardsContainerModule } from './containers/package-cards/package-cards.module'; | ||
import { DaffioGuidesRoutingModule } from './guides-routing.module'; | ||
import { DaffioGuidesPageComponent } from './pages/guides-page.component'; | ||
import { DaffioPackagesOverviewPageComponent } from './pages/packages-overview/packages-overview.component'; | ||
import { DaffioDocViewerModule } from '../docs/components/doc-viewer/doc-viewer.module'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
RouterModule, | ||
|
||
DaffioDocViewerModule, | ||
DaffioGuidesRoutingModule, | ||
DaffContainerModule, | ||
DaffHeroModule, | ||
DaffioDocsPackageCardsContainerModule, | ||
], | ||
declarations: [ | ||
DaffioGuidesPageComponent, | ||
DaffioPackagesOverviewPageComponent, | ||
], | ||
exports: [ | ||
DaffioGuidesPageComponent, | ||
DaffioPackagesOverviewPageComponent, | ||
], | ||
}) | ||
export class DaffioGuidesModule {} |
10 changes: 10 additions & 0 deletions
10
apps/daffio/src/app/guides/pages/packages-overview/packages-overview.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<daff-hero> | ||
<daff-container size="md"> | ||
<h1 daffHeroTitle>Packages</h1> | ||
<p daffHeroSubtitle>Learn how to build and optimize an ecommerce store with our packages.</p> | ||
</daff-container> | ||
</daff-hero> | ||
|
||
<daff-container size="md"> | ||
<daffio-docs-package-cards-container class="daffio-packages-overview__card-grid"></daffio-docs-package-cards-container> | ||
</daff-container> |
16 changes: 16 additions & 0 deletions
16
apps/daffio/src/app/guides/pages/packages-overview/packages-overview.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@use 'utilities' as daff; | ||
|
||
.daffio-packages-overview { | ||
&__card-grid { | ||
display: block; | ||
padding: 0 24px; | ||
|
||
@include daff.breakpoint(tablet) { | ||
padding: 48px; | ||
} | ||
|
||
@include daff.breakpoint(small-laptop) { | ||
padding: 48px 0; | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
apps/daffio/src/app/guides/pages/packages-overview/packages-overview.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
ComponentFixture, | ||
TestBed, | ||
waitForAsync, | ||
} from '@angular/core/testing'; | ||
import { RouterTestingModule } from '@angular/router/testing'; | ||
|
||
import { DaffioPackagesOverviewPageComponent } from './packages-overview.component'; | ||
|
||
describe('DaffioPackagesOverviewPageComponent', () => { | ||
let component: DaffioPackagesOverviewPageComponent; | ||
let fixture: ComponentFixture<DaffioPackagesOverviewPageComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
DaffioPackagesOverviewPageComponent, | ||
], | ||
imports: [ | ||
RouterTestingModule, | ||
], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DaffioPackagesOverviewPageComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
apps/daffio/src/app/guides/pages/packages-overview/packages-overview.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'daffio-packages-overview', | ||
templateUrl: './packages-overview.component.html', | ||
styleUrls: ['./packages-overview.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DaffioPackagesOverviewPageComponent {} |