**Structure Before:** examples/ ├── HighFive.py, HighFive.html, HighFive.wasm, HighFive.ll (loose files) ├── highfive.html (old duplicate) ├── tabs/Tabs.* └── textinput/TextInput.* **Structure After:** examples/ ├── highfive/HighFive.* ├── tabs/Tabs.* └── textinput/TextInput.* **Changes:** - Moved all HighFive.* files to examples/highfive/ subdirectory - Updated paths in HighFive.html: runtime/ → ../runtime/ - Removed old duplicate highfive.html file - Now consistent with tabs/ and textinput/ structure **Testing:** Access via: http://localhost:8111/highfive/HighFive.html 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
27 lines
595 B
Python
27 lines
595 B
Python
"""
|
|
HighFive counter component - Demonstrates reactive signals and event handlers.
|
|
|
|
This component uses a signal to track state and an onclick handler to update it.
|
|
"""
|
|
|
|
from ritz.syntax import *
|
|
|
|
|
|
@component
|
|
def HighFive():
|
|
"""A counter that tracks high fives."""
|
|
high_fives = signal(0)
|
|
|
|
def increment():
|
|
high_fives += 1
|
|
|
|
with Div(class_="high-five-app"):
|
|
with P():
|
|
yield "Give me a high five! ✋"
|
|
|
|
with P(class_="count"):
|
|
yield f"High fives: {high_fives}"
|
|
|
|
with Button(onclick=increment):
|
|
yield "High Five!"
|