|
7 | 7 | */ |
8 | 8 |
|
9 | 9 | import {Fragment, h} from 'preact'; |
10 | | -import {ClassEntryRenderable, DecoratorEntryRenderable} from '../entities/renderables'; |
| 10 | +import { |
| 11 | + ClassEntryRenderable, |
| 12 | + DecoratorEntryRenderable, |
| 13 | + PipeEntryRenderable, |
| 14 | +} from '../entities/renderables'; |
11 | 15 | import {ClassMemberList} from './class-member-list'; |
12 | 16 | import {HeaderApi} from './header-api'; |
13 | | -import {API_REFERENCE_CONTAINER, REFERENCE_MEMBERS} from '../styling/css-classes'; |
| 17 | +import { |
| 18 | + API_REFERENCE_CONTAINER, |
| 19 | + REFERENCE_MEMBERS, |
| 20 | + SECTION_CONTAINER, |
| 21 | +} from '../styling/css-classes'; |
14 | 22 | import {SectionDescription} from './section-description'; |
15 | 23 | import {SectionUsageNotes} from './section-usage-notes'; |
16 | 24 | import {SectionApi} from './section-api'; |
| 25 | +import {SectionHeading} from './section-heading'; |
| 26 | +import {PipeEntry} from '../entities'; |
| 27 | +import {codeToHtml} from '../shiki/shiki'; |
| 28 | +import {RawHtml} from './raw-html'; |
17 | 29 |
|
18 | 30 | /** Component to render a class API reference document. */ |
19 | | -export function ClassReference(entry: ClassEntryRenderable | DecoratorEntryRenderable) { |
| 31 | +export function ClassReference( |
| 32 | + entry: ClassEntryRenderable | DecoratorEntryRenderable | PipeEntryRenderable, |
| 33 | +) { |
20 | 34 | return ( |
21 | 35 | <div className={API_REFERENCE_CONTAINER}> |
22 | 36 | <HeaderApi entry={entry} /> |
| 37 | + {entry.entryType === 'pipe' ? ( |
| 38 | + <> |
| 39 | + <div className={SECTION_CONTAINER + ' docs-reference-api-section'}> |
| 40 | + <SectionHeading name="Pipe usage" /> |
| 41 | + <RawHtml value={codeToHtml((entry as PipeEntry).usage, 'angular-html')} /> |
| 42 | + </div> |
| 43 | + </> |
| 44 | + ) : ( |
| 45 | + '' |
| 46 | + )} |
23 | 47 | <SectionApi entry={entry} /> |
24 | 48 | {entry.members.length > 0 ? ( |
25 | 49 | <div class={REFERENCE_MEMBERS}> |
|
0 commit comments