mirror of
https://github.com/storybookjs/storybook.git
synced 2026-09-28 18:03:02 +08:00
27 lines
529 B
TypeScript
27 lines
529 B
TypeScript
import { Component, Input } from '@angular/core';
|
|
|
|
@Component({
|
|
standalone: false,
|
|
selector: 'storybook-pre',
|
|
template: `
|
|
<pre data-testid="pre" [ngStyle]="style">{{ finalText }}</pre>
|
|
`,
|
|
})
|
|
export default class PreComponent {
|
|
/** Styles to apply to the component */
|
|
@Input()
|
|
style?: object;
|
|
|
|
/** An object to render */
|
|
@Input()
|
|
object?: object;
|
|
|
|
/** The code to render */
|
|
@Input()
|
|
text?: string;
|
|
|
|
get finalText() {
|
|
return this.object ? JSON.stringify(this.object, null, 2) : this.text;
|
|
}
|
|
}
|