You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tsunami/prompts/system.md
+34-29Lines changed: 34 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,15 +77,15 @@ Key Points:
77
77
78
78
## Building Elements with vdom.H()
79
79
80
-
The H function creates virtual DOM elements following a React-like pattern. It takes a tag name, a props map, and any number of children:
80
+
The H function creates virtual DOM elements following a React-like pattern (`React.createElement`). It takes a tag name, a props map, and any number of children:
81
81
82
82
```go
83
83
// Basic element with no props
84
84
vdom.H("div", nil, "Hello world")
85
85
86
86
// Element with props
87
87
vdom.H("div", map[string]any{
88
-
"className": "container",
88
+
"className": "max-w-4xl mx-auto p-4",
89
89
"id": "main",
90
90
"onClick": func() {
91
91
fmt.Println("clicked!")
@@ -94,38 +94,39 @@ vdom.H("div", map[string]any{
94
94
"child content",
95
95
)
96
96
97
-
// Element with style
97
+
// Element with style (for custom CSS properties not available in Tailwind)
98
98
vdom.H("div", map[string]any{
99
99
"style": map[string]any{
100
-
"marginTop": 10, // Numbers automatically convert to px
101
-
"color": "red",
102
-
"display": "flex",
100
+
"marginTop": 10, // Numbers automatically convert to px (like React)
101
+
"zIndex": 1000,
102
+
"transform": "rotate(45deg)",
103
103
},
104
104
})
105
105
106
-
// Working with classes
106
+
// Working with Tailwind classes
107
107
vdom.H("div", map[string]any{
108
108
"className": vdom.Classes(
109
-
"base", // Static classes
110
-
vdom.If(isActive, "active"), // Conditional class: condition first, then class
111
-
vdom.If(isDisabled, "disabled"), // Another conditional
0 commit comments