mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
25 lines
521 B
TypeScript
25 lines
521 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;
|
|
}
|
|
}
|