Skip to content

Commit

Permalink
feat(daffio): add dynamically rendered design component doc view
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 committed Jan 9, 2025
1 parent b805fe7 commit 5a7e48e
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 235 deletions.
25 changes: 25 additions & 0 deletions apps/daffio/src/app/docs/design/components/doc/component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<daffio-doc-article [breadcrumbs]="doc().breadcrumbs">
<daff-tabs>
<daff-tab>
<daff-tab-label>
Usage
</daff-tab-label>
<daff-tab-panel>
<daff-article
[innerHtml]="doc().contents | safe">
</daff-article>
</daff-tab-panel>
</daff-tab>

<daff-tab>
<daff-tab-label>
API
</daff-tab-label>
<daff-tab-panel>
@for (apiDoc of doc().api; track $index) {
<div [innerHtml]="apiDoc | safe"></div>
}
</daff-tab-panel>
</daff-tab>
</daff-tabs>
</daffio-doc-article>
34 changes: 34 additions & 0 deletions apps/daffio/src/app/docs/design/components/doc/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
ChangeDetectionStrategy,
Component,
input,
} from '@angular/core';

import { DAFF_ARTICLE_COMPONENTS } from '@daffodil/design/article';
import { DAFF_TABS_COMPONENTS } from '@daffodil/design/tabs';
import {
DaffDocKind,
DaffPackageGuideDoc,
} from '@daffodil/docs-utils';

import { DaffioSafeHtmlPipe } from '../../../../core/html-sanitizer/safe.pipe';
import { DaffioDocArticleModule } from '../../../components/doc-article/module';
import { DaffioDocComponent } from '../../../components/doc-renderer/component.type';

@Component({
selector: 'daffio-docs-design-component-page',
templateUrl: './component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
DAFF_TABS_COMPONENTS,
DAFF_ARTICLE_COMPONENTS,
DaffioDocArticleModule,
DaffioSafeHtmlPipe,
],
})
export class DaffioDocsDesignComponentDocComponent implements DaffioDocComponent<DaffPackageGuideDoc> {
static readonly kind = DaffDocKind.COMPONENT;

doc = input<DaffPackageGuideDoc>();
}
4 changes: 4 additions & 0 deletions apps/daffio/src/app/docs/design/components/doc/provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { DaffioDocsDesignComponentDocComponent } from './component';
import { provideDaffioDocRendererComponents } from '../../../components/doc-renderer/token';

export const daffioDocsDesignComponentProvider = () => provideDaffioDocRendererComponents(DaffioDocsDesignComponentDocComponent);
17 changes: 0 additions & 17 deletions apps/daffio/src/app/docs/design/design-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ import {
} from '@daffodil/docs-utils';

import { DAFFIO_DOCS_DESIGN_LIST_SIDEBAR_REGISTRATION } from './containers/docs-list/sidebar.provider';
import { DaffioDocsDesignComponentPageComponent } from './pages/component/component';
import { DaffioDocsDesignComponentOverviewPageComponent } from './pages/components-overview/component-overview.component';
import { DaffioDocsDesignOverviewPageComponent } from './pages/overview/overview.component';
import { DaffioDesignComponentDocResolver } from './resolvers/component-doc-resolver.service';
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';
Expand Down Expand Up @@ -51,21 +49,6 @@ export const docsDesignRoutes: Routes = [
path: DAFF_DOC_KIND_PATH_SEGMENT_MAP[DaffDocKind.COMPONENT],
component: DaffioDocsDesignComponentOverviewPageComponent,
},
{
path: 'components',
children: [
<DaffioRoute>{
path: '**',
component: DaffioDocsDesignComponentPageComponent,
resolve: {
doc: DaffioDesignComponentDocResolver,
},
data: {
sidebarMode: DaffSidebarModeEnum.SideFixed,
},
},
],
},
<DaffioRoute>{
path: '**',
component: DaffioDocsPageComponent,
Expand Down
2 changes: 2 additions & 0 deletions apps/daffio/src/app/docs/design/design.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NgModule } from '@angular/core';

import { daffioDocsDesignComponentProvider } from './components/doc/provider';
import { DaffioDocsDesignRoutingModule } from './design-routing.module';
import { DaffioDocsDesignIndexService } from './services/index.service';

Expand All @@ -9,6 +10,7 @@ import { DaffioDocsDesignIndexService } from './services/index.service';
],
providers: [
DaffioDocsDesignIndexService,
daffioDocsDesignComponentProvider(),
],
})
export class DaffioDocsDesignModule {}
27 changes: 0 additions & 27 deletions apps/daffio/src/app/docs/design/pages/component/component.html

This file was deleted.

55 changes: 0 additions & 55 deletions apps/daffio/src/app/docs/design/pages/component/component.ts

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 5a7e48e

Please sign in to comment.