Skip to content

Commit

Permalink
Modified codegen template
Browse files Browse the repository at this point in the history
  • Loading branch information
anant-writer committed May 27, 2024
1 parent e44b148 commit 85ccde9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ src/ui/components.codegen.json
playground/
*.mp4
.turbo
styles.css
3 changes: 1 addition & 2 deletions docs/codegen/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export function generateLowCodeUsage(component) {
*/
export function generateEventHandler() {
let code = `def handle_event(state, payload, context, ui):
pass
`
pass`
return code
}

Expand Down
60 changes: 28 additions & 32 deletions docs/docs/components/component_page.mdx.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: {{ name }}
mode: "wide"
---

{{ description }}
Expand All @@ -18,43 +19,38 @@ title: {{ name }}
<td>Description</td>
<td>Options</td>
</thead>
{% for _, field in fields %}
<tr>
<td>{{ field.name }}</td>
<td>{{ field.type }}</td>
<td>{{ field.desc }}</td>
<td>
<ul>
{% for _, option in field.options %}
<li>{{ option }}</li>
{% endfor %}
</ul>
</td>
</tr>
{% endfor %}
<tbody>
{% for _, field in fields %}
<tr>
<td>{{ field.name }}</td>
<td>{{ field.type }}</td>
<td>{{ field.desc }}</td>
<td>
<ol>
{% for _, option in field.options %}
<li>{{ option }}</li>
{% endfor %}
</ol>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}

{% if events %}
## Events
<table>
<thead>
<td>Name</td>
<td>Description</td>
<td>Usage</td>
</thead>
{% for event, eventInfo in events %}
<tr>
<td>{{ event }}</td>
<td>{{ eventInfo.desc }}</td>
<td>
```python
{{ eventInfo.stub | safe }}
```
</td>
</tr>
{% endfor %}
</table>
<AccordionGroup>
{% for event, eventInfo in events %}
<Accordion title="{{ event }}" icon="code">
{{ eventInfo.desc }}

```python
{{ eventInfo.stub | safe }}
```
</Accordion>
{% endfor %}
</AccordionGroup>
{% endif %}

## Low code usage
Expand Down
3 changes: 2 additions & 1 deletion mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
{
"group": "Component list",
"pages": [
"docs/docs/components/avatar"
"docs/docs/components/avatar",
"docs/docs/components/button"
]
}
],
Expand Down

0 comments on commit 85ccde9

Please sign in to comment.