## Summary
Add a todo list example that demonstrates core Iris reactive patterns.
## Changes
- Add `examples/todo/main.go` with a complete todo list application
- Demonstrates Signal holding a slice/list of todos
- Shows adding and removing items dynamically via signals
- Component composition pattern (inputRow, todoList, todoItem functions)
- Input handling with TextInput and Enter key support
- Conditional rendering (empty state message, strikethrough for completed items)
## Patterns Demonstrated
- **Signal with slice**: `reactive.NewSignal([]Todo{})` for managing a list
- **Component composition**: Separate functions for `todoItem`, `todoList`, `inputRow`
- **Effects for list rendering**: Using `reactive.NewEffect` to re-render when todos change
- **Event handling**: Checkbox toggle, delete button, Enter key on input
- **Conditional styling**: Strikethrough and color change for completed items
Closes #5
This example demonstrates Iris reactive patterns:
- Signal holding a slice/list of todos
- Adding and removing items dynamically
- Component composition (inputRow, todoList, todoItem)
- Input handling with TextInput and Enter key support
- Conditional rendering (empty state, strikethrough for completed)
Closes#5
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comprehensive todo list example demonstrating reactive list management, component composition, and event handling. Well-structured with good separation of concerns.
Issue: Internal Package Import
The example imports git.flowmade.one/flowmade-one/iris/internal/element (line 9). This is problematic:
Users copying examples shouldn't depend on internal APIs
Add public components - Create ui.Checkbox and use ui.Text with styling support
Export element creation - If needed, expose element creation through the public ui package
For now, consider if the checkbox functionality can be achieved with existing ui components, or flag that this example requires framework additions.
Other Notes
Component composition pattern is excellent
Effect-based re-rendering is a good demonstration
Helper functions (toggleTodo, deleteTodo) are clean
Please remove the internal package dependency before merging.
## Code Review
### Summary
Comprehensive todo list example demonstrating reactive list management, component composition, and event handling. Well-structured with good separation of concerns.
### Issue: Internal Package Import
The example imports `git.flowmade.one/flowmade-one/iris/internal/element` (line 9). This is problematic:
1. Users copying examples shouldn't depend on internal APIs
2. Internal packages may change without notice
3. Examples should demonstrate the public API
### Affected Code
**Line 145-148**: Raw checkbox element
```go
checkbox := element.NewElement("input")
checkbox.Attr("type", "checkbox")
```
**Line 155-158**: Raw span element
```go
text := element.NewElement("span")
text.Set("textContent", todo.Text)
```
### Suggested Fix
Either:
1. **Add public components** - Create `ui.Checkbox` and use `ui.Text` with styling support
2. **Export element creation** - If needed, expose element creation through the public `ui` package
For now, consider if the checkbox functionality can be achieved with existing `ui` components, or flag that this example requires framework additions.
### Other Notes
- Component composition pattern is excellent
- Effect-based re-rendering is a good demonstration
- Helper functions (toggleTodo, deleteTodo) are clean
Please remove the internal package dependency before merging.
Replace direct internal/element usage with public ui package
components to ensure examples only use the public API:
- Add ui.RawCheckbox for plain checkbox without label wrapper
- Add ui.Span for span elements with text content
- Add View.TextDecoration modifier for strikethrough styling
- Update todo example to use these public components
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Internal package import removed. Added public API components:
ui.RawCheckbox for plain checkbox input
ui.Span for span elements
View.TextDecoration modifier
LGTM - merging.
## Code Review - Approved
Comprehensive todo list example demonstrating reactive list management, component composition, and event handling.
### Highlights
- Clean component composition pattern (`inputRow`, `todoList`, `todoItem`)
- Signal-based state management for todos and input
- Effect-based re-rendering when todos change
- Good helper functions (`toggleTodo`, `deleteTodo`)
### Previous Feedback
Internal package import removed. Added public API components:
- `ui.RawCheckbox` for plain checkbox input
- `ui.Span` for span elements
- `View.TextDecoration` modifier
LGTM - merging.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Add a todo list example that demonstrates core Iris reactive patterns.
Changes
examples/todo/main.gowith a complete todo list applicationPatterns Demonstrated
reactive.NewSignal([]Todo{})for managing a listtodoItem,todoList,inputRowreactive.NewEffectto re-render when todos changeCloses #5
Code Review
Summary
Comprehensive todo list example demonstrating reactive list management, component composition, and event handling. Well-structured with good separation of concerns.
Issue: Internal Package Import
The example imports
git.flowmade.one/flowmade-one/iris/internal/element(line 9). This is problematic:Affected Code
Line 145-148: Raw checkbox element
Line 155-158: Raw span element
Suggested Fix
Either:
ui.Checkboxand useui.Textwith styling supportuipackageFor now, consider if the checkbox functionality can be achieved with existing
uicomponents, or flag that this example requires framework additions.Other Notes
Please remove the internal package dependency before merging.
Code Review - Approved
Comprehensive todo list example demonstrating reactive list management, component composition, and event handling.
Highlights
inputRow,todoList,todoItem)toggleTodo,deleteTodo)Previous Feedback
Internal package import removed. Added public API components:
ui.RawCheckboxfor plain checkbox inputui.Spanfor span elementsView.TextDecorationmodifierLGTM - merging.