feat: create space
This commit is contained in:
parent
8e952455cd
commit
775177cba1
11 changed files with 200 additions and 3 deletions
48
internal/ui/forms/create_space.templ
Normal file
48
internal/ui/forms/create_space.templ
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
package forms
|
||||
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/card"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/routeurl"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/form"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/input"
|
||||
import "git.juancwu.dev/juancwu/budgit/internal/ui/components/button"
|
||||
|
||||
templ CreateSpace(errMsg string, spaceName string) {
|
||||
<form hx-post={ routeurl.URL("action.app.spaces.create") }>
|
||||
@card.Card(card.Props{Class: "rounded-sm"}) {
|
||||
@card.Content(card.ContentProps{Class: "p-4"}) {
|
||||
@form.Item() {
|
||||
@form.Label(form.LabelProps{
|
||||
For: "space-name",
|
||||
}) {
|
||||
Space Name
|
||||
}
|
||||
@input.Input(input.Props{
|
||||
ID: "space-name",
|
||||
Type: input.TypeText,
|
||||
Placeholder: "My Expenses",
|
||||
Class: "rounded-sm",
|
||||
Name: "name",
|
||||
Value: spaceName,
|
||||
HasError: errMsg != "",
|
||||
Attributes: templ.Attributes{
|
||||
"autocomplete": "off",
|
||||
},
|
||||
})
|
||||
if errMsg != "" {
|
||||
@form.Message(form.MessageProps{Variant: form.MessageVariantError}) {
|
||||
{ errMsg }
|
||||
}
|
||||
}
|
||||
@form.Description() {
|
||||
You can always rename your space later in space settings.
|
||||
}
|
||||
}
|
||||
}
|
||||
@card.Footer() {
|
||||
@button.Button(button.Props{Class: "w-full", Type: button.TypeSubmit}) {
|
||||
Create
|
||||
}
|
||||
}
|
||||
}
|
||||
</form>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue