mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 07:41:58 +08:00
15 lines
293 B
JavaScript
15 lines
293 B
JavaScript
export const Pre = (args) => {
|
|
const pre = document.createElement('pre');
|
|
|
|
pre.setAttribute('data-testid', 'pre');
|
|
pre.style = args.style;
|
|
|
|
if (args.object) {
|
|
pre.textContent = JSON.stringify(args.object, null, 2);
|
|
} else {
|
|
pre.textContent = args.text;
|
|
}
|
|
|
|
return pre;
|
|
};
|