-
-
Notifications
You must be signed in to change notification settings - Fork 31
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 design docs route (#3113)
* feat(docs-utils): add component doc kind * feat(dgeni): gen design packages and guides together * feat(daffio): generalize docs routing * feat(daffio): add design docs route * move guides into foundations folder --------- Co-authored-by: xelaint <xelaint@gmail.com>
- Loading branch information
Showing
32 changed files
with
498 additions
and
85 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
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
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
1 change: 1 addition & 0 deletions
1
apps/daffio/src/app/docs/design/containers/docs-list/docs-list.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-list [list]="docsList$ | async"></daffio-docs-list> |
39 changes: 39 additions & 0 deletions
39
apps/daffio/src/app/docs/design/containers/docs-list/docs-list.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,39 @@ | ||
import { | ||
provideHttpClient, | ||
withInterceptorsFromDi, | ||
} from '@angular/common/http'; | ||
import { provideHttpClientTesting } 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 { DaffioDocsDesignListContainer } from './docs-list.component'; | ||
|
||
describe('DaffioDocsDesignListContainer', () => { | ||
let component: DaffioDocsDesignListContainer; | ||
let fixture: ComponentFixture<DaffioDocsDesignListContainer>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [DaffioDocsDesignListContainer, | ||
RouterTestingModule, | ||
NoopAnimationsModule], | ||
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()], | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DaffioDocsDesignListContainer); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
36 changes: 36 additions & 0 deletions
36
apps/daffio/src/app/docs/design/containers/docs-list/docs-list.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,36 @@ | ||
import { AsyncPipe } from '@angular/common'; | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
OnInit, | ||
} from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
|
||
import { DaffioDocsListComponent } from '../../../components/docs-list/docs-list.component'; | ||
import { DaffioDocList } from '../../../models/doc-list'; | ||
import { DaffioDocsDesignIndexService } from '../../services/index.service'; | ||
|
||
@Component({ | ||
selector: 'daffio-docs-design-list-container', | ||
templateUrl: './docs-list.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
AsyncPipe, | ||
DaffioDocsListComponent, | ||
], | ||
providers: [ | ||
DaffioDocsDesignIndexService, | ||
], | ||
}) | ||
export class DaffioDocsDesignListContainer implements OnInit { | ||
docsList$: Observable<DaffioDocList>; | ||
|
||
constructor( | ||
private index: DaffioDocsDesignIndexService, | ||
) {} | ||
|
||
ngOnInit() { | ||
this.docsList$ = this.index.getList(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/daffio/src/app/docs/design/containers/docs-list/sidebar.provider.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 { DaffioDocsDesignListContainer } from './docs-list.component'; | ||
import { DaffioSidebarFooterComponent } from '../../../../core/sidebar/components/sidebar-footer/sidebar-footer.component'; | ||
import { DaffioSidebarHeaderComponent } from '../../../../core/sidebar/components/sidebar-header/sidebar-header.component'; | ||
|
||
export const DAFFIO_DOCS_DESIGN_LIST_SIDEBAR_ID = 'daffioDocsList'; | ||
|
||
export const DAFFIO_DOCS_DESIGN_LIST_SIDEBAR_REGISTRATION = { | ||
id: DAFFIO_DOCS_DESIGN_LIST_SIDEBAR_ID, | ||
header: DaffioSidebarHeaderComponent, | ||
body: DaffioDocsDesignListContainer, | ||
footer: DaffioSidebarFooterComponent, | ||
}; |
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,68 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { | ||
Routes, | ||
RouterModule, | ||
} from '@angular/router'; | ||
|
||
import { DaffSidebarModeEnum } from '@daffodil/design/sidebar'; | ||
import { | ||
DAFF_DOC_KIND_PATH_SEGMENT_MAP, | ||
DAFF_DOCS_DESIGN_PATH, | ||
DAFF_DOCS_PATH, | ||
DaffDocKind, | ||
} from '@daffodil/docs-utils'; | ||
|
||
import { DAFFIO_DOCS_DESIGN_LIST_SIDEBAR_REGISTRATION } from './containers/docs-list/sidebar.provider'; | ||
import { DaffioDocsDesignOverviewPageComponent } from './pages/overview/overview.component'; | ||
import { DAFF_NAV_SIDEBAR_REGISTRATION } from '../../core/nav/sidebar.provider'; | ||
import { DaffioRoute } from '../../core/router/route.type'; | ||
import { DaffioDocsPageComponent } from '../pages/docs-page/docs-page.component'; | ||
import { DocsResolver } from '../resolvers/docs-resolver.service'; | ||
|
||
export const docsDesignRoutes: Routes = [ | ||
<DaffioRoute>{ | ||
path: '', | ||
data: { | ||
docPrefix: `${DAFF_DOCS_PATH}/${DAFF_DOCS_DESIGN_PATH}`, | ||
daffioSidebars: { | ||
[DAFF_NAV_SIDEBAR_REGISTRATION.id]: DAFF_NAV_SIDEBAR_REGISTRATION, | ||
[DAFFIO_DOCS_DESIGN_LIST_SIDEBAR_REGISTRATION.id]: DAFFIO_DOCS_DESIGN_LIST_SIDEBAR_REGISTRATION, | ||
}, | ||
daffioDockedSidebar: DAFFIO_DOCS_DESIGN_LIST_SIDEBAR_REGISTRATION.id, | ||
// daffNamedViews: { | ||
// [DaffioRouterNamedViewsEnum.FOOTER]: DaffioSimpleFooterComponent, | ||
// }, | ||
}, | ||
children: [ | ||
{ | ||
path: DAFF_DOC_KIND_PATH_SEGMENT_MAP[DaffDocKind.API], | ||
loadChildren: () => import('../api/api.module').then(m => m.DaffioApiModule), | ||
}, | ||
{ | ||
path: '', | ||
pathMatch: 'full', | ||
component: DaffioDocsDesignOverviewPageComponent, | ||
}, | ||
<DaffioRoute>{ | ||
path: '**', | ||
component: DaffioDocsPageComponent, | ||
resolve: { | ||
doc: DocsResolver, | ||
}, | ||
data: { | ||
sidebarMode: DaffSidebarModeEnum.SideFixed, | ||
}, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [ | ||
RouterModule.forChild(docsDesignRoutes), | ||
], | ||
exports: [ | ||
RouterModule, | ||
], | ||
}) | ||
export class DaffioDocsDesignRoutingModule { } |
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 @@ | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { DaffioDocsDesignRoutingModule } from './design-routing.module'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
DaffioDocsDesignRoutingModule, | ||
], | ||
}) | ||
export class DaffioDocsDesignModule {} |
5 changes: 5 additions & 0 deletions
5
apps/daffio/src/app/docs/design/pages/overview/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,5 @@ | ||
<daff-container size="md"> | ||
<h1 class="daffio-docs-design-overview__title">Daffodil Design</h1> | ||
<p class="daffio-docs-design-overview__subtitle">Design and build seamless, intuitive, and accessible experiences with Daffodil Design System — an open-source library built with Angular.</p> | ||
<a daff-button color="primary" routerLink="./getting-started">Get started</a> | ||
</daff-container> |
25 changes: 25 additions & 0 deletions
25
apps/daffio/src/app/docs/design/pages/overview/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,25 @@ | ||
@use 'utilities' as daff; | ||
|
||
:host { | ||
display: block; | ||
padding: 48px 24px; | ||
|
||
@include daff.breakpoint(tablet) { | ||
padding: 48px 96px; | ||
} | ||
} | ||
|
||
.daffio-docs-design-overview { | ||
&__title { | ||
@include daff.headline-xl(); | ||
margin: 0 0 16px; | ||
padding: 0; | ||
} | ||
|
||
&__subtitle { | ||
@include daff.body-lg; | ||
font-weight: 400; | ||
margin: 0 0 32px; | ||
padding: 0; | ||
} | ||
} |
Oops, something went wrong.