forked from nodejs/nodejs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.stories.tsx
More file actions
38 lines (29 loc) · 885 Bytes
/
index.stories.tsx
File metadata and controls
38 lines (29 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
import CodeBox from '@/components/Common/CodeBox';
type Story = StoryObj<typeof CodeBox>;
type Meta = MetaObj<typeof CodeBox>;
const content = `const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});
server.listen(port, hostname, () => {
console.log(\`Server running at http://\${hostname}:\${port}/\`);
});`;
export const Default: Story = {
args: {
language: 'JavaScript (CJS)',
children: <code>{content}</code>,
},
};
export const WithCopyButton: Story = {
args: {
language: 'JavaScript (CJS)',
showCopyButton: true,
children: <code>{content}</code>,
},
};
export default { component: CodeBox } as Meta;