File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed
site/src/modules/templates/TemplateFiles Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change
1
+ import type { Meta , StoryObj } from "@storybook/react" ;
2
+ import { chromatic } from "testHelpers/chromatic" ;
3
+ import { TemplateFileTree } from "./TemplateFileTree" ;
4
+ import { FileTree } from "utils/filetree" ;
5
+ import { useTheme } from "@emotion/react" ;
6
+
7
+ const fileTree : FileTree = {
8
+ "main.tf" : "resource aws_instance my_instance {}" ,
9
+ "variables.tf" : "variable my_var {}" ,
10
+ "outputs.tf" : "output my_output {}" ,
11
+ folder : {
12
+ "nested.tf" : "resource aws_instance my_instance {}" ,
13
+ } ,
14
+ } ;
15
+
16
+ const meta : Meta < typeof TemplateFileTree > = {
17
+ title : "modules/templates/TemplateFileTree" ,
18
+ parameters : { chromatic } ,
19
+ component : TemplateFileTree ,
20
+ args : {
21
+ fileTree,
22
+ activePath : "main.tf" ,
23
+ } ,
24
+ decorators : [
25
+ ( Story ) => {
26
+ const theme = useTheme ( ) ;
27
+ return (
28
+ < div
29
+ css = { {
30
+ maxWidth : 260 ,
31
+ borderRadius : 8 ,
32
+ border : `1px solid ${ theme . palette . divider } ` ,
33
+ } }
34
+ >
35
+ < Story />
36
+ </ div >
37
+ ) ;
38
+ } ,
39
+ ] ,
40
+ } ;
41
+
42
+ export default meta ;
43
+ type Story = StoryObj < typeof TemplateFileTree > ;
44
+
45
+ export const Example : Story = { } ;
46
+
47
+ export const NestedOpen : Story = {
48
+ args : {
49
+ activePath : "folder/nested.tf" ,
50
+ } ,
51
+ } ;
Original file line number Diff line number Diff line change @@ -26,4 +26,14 @@ type Story = StoryObj<typeof TemplateFiles>;
26
26
27
27
const Example : Story = { } ;
28
28
29
+ export const WithDiff : Story = {
30
+ args : {
31
+ currentFiles : {
32
+ ...exampleFiles ,
33
+ "main.tf" : `${ exampleFiles [ "main.tf" ] } - with changes` ,
34
+ } ,
35
+ baseFiles : exampleFiles ,
36
+ } ,
37
+ } ;
38
+
29
39
export { Example as TemplateFiles } ;
You can’t perform that action at this time.
0 commit comments