mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-11-24 11:44:51 +03:00
90 lines
1.8 KiB
JavaScript
90 lines
1.8 KiB
JavaScript
// Test .wasp file.
|
|
|
|
import something from "@ext/some/file"
|
|
|
|
// App definition.
|
|
app test_app {
|
|
// Title of the app.
|
|
title: "Hello World!"
|
|
}
|
|
|
|
route "/" -> page Landing
|
|
page Landing {
|
|
content: {=jsx
|
|
<div>
|
|
My landing page! I have { this.props.taskList.length } tasks.
|
|
|
|
<div>
|
|
<TaskCreateForm
|
|
onCreate={task => this.props.addTask(task)}
|
|
submitButtonLabel={'Create new task'}
|
|
/>
|
|
</div>
|
|
|
|
My tasks
|
|
<TaskList />
|
|
</div>
|
|
jsx=},
|
|
style: {=css
|
|
div {
|
|
color: red
|
|
}
|
|
css=}
|
|
}
|
|
|
|
route "/test" -> page TestPage
|
|
page TestPage {
|
|
content: {=jsx
|
|
<div>This is a test page!</div>
|
|
jsx=},
|
|
style: "@ext/test.css"
|
|
}
|
|
|
|
// Entity definition.
|
|
entity Task {
|
|
description :: string,
|
|
isDone :: boolean
|
|
}
|
|
|
|
// NOTE(matija): this is only being parsed for now, no code is generated yet.
|
|
// Entity form definition.
|
|
entity-form<Task> CreateTaskForm {
|
|
fields: {
|
|
description: {
|
|
show: true,
|
|
defaultValue: "doable task",
|
|
label: none,
|
|
placeholder: "What will you do?"
|
|
},
|
|
isDone: {
|
|
show: false,
|
|
defaultValue: false // Although not shown, this field will be set to "false".
|
|
}
|
|
},
|
|
submit: {
|
|
onEnter: false,
|
|
button: {
|
|
show: true
|
|
}
|
|
}
|
|
}
|
|
|
|
entity-list<Task> TaskList {
|
|
showHeader: false,
|
|
fields: {
|
|
description: {
|
|
render: {=js
|
|
task => task.description
|
|
js=}
|
|
}
|
|
},
|
|
mutuallyExclusiveFilters: {
|
|
completed: {=js task => task.isDone js=},
|
|
active: {=js task => !task.isDone js=}
|
|
}
|
|
}
|
|
|
|
query myQuery {
|
|
fn: import { myJsQuery } from "@ext/some/path"
|
|
}
|