Swap Bulma for DaisyUI (Tailwind) (#111)

This commit is contained in:
Mike Stefanello 2025-06-17 20:19:58 -04:00 committed by GitHub
parent fc5db0e95a
commit c1e9baabe6
53 changed files with 1124 additions and 632 deletions

View file

@ -113,10 +113,10 @@ func AdminEntity(r *ui.Request, schema *load.Schema, values url.Values) Node {
Method(http.MethodPost),
nodes,
ControlGroup(
FormButton("is-primary", "Submit"),
FormButton(ColorPrimary, "Submit"),
ButtonLink(
ColorNone,
r.Path(routenames.AdminEntityList(schema.Name)),
"is-secondary",
"Cancel",
),
),

View file

@ -14,14 +14,13 @@ func AdminEntityDelete(r *ui.Request, entityTypeName string) Node {
return Form(
Method(http.MethodPost),
P(
Class("subtitle"),
Textf("Are you sure you want to delete this %s?", entityTypeName),
),
ControlGroup(
FormButton("is-link", "Delete"),
FormButton(ColorError, "Delete"),
ButtonLink(
ColorNone,
r.Path(routenames.AdminEntityList(entityTypeName)),
"is-secondary",
"Cancel",
),
),

View file

@ -22,21 +22,22 @@ func (f *Cache) Render(r *ui.Request) Node {
ID("cache"),
Method(http.MethodPost),
Attr("hx-post", r.Path(routenames.CacheSubmit)),
Message(
"is-info",
"Test the cache",
Group{
P(Text("This route handler shows how the default in-memory cache works. Try updating the value using the form below and see how it persists after you reload the page.")),
P(Text("HTMX makes it easy to re-render the cached value after the form is submitted.")),
Card(CardParams{
Title: "Test the cache",
Body: Group{
Span(Text("This route handler shows how the default in-memory cache works. Try updating the value using the form below and see how it persists after you reload the page.")),
Span(Text("HTMX makes it easy to re-render the cached value after the form is submitted.")),
},
),
Color: ColorInfo,
Size: SizeMedium,
}),
Label(
For("value"),
Class("value"),
Text("Value in cache: "),
),
If(f.CurrentValue != "", Span(Class("tag is-success"), Text(f.CurrentValue))),
If(f.CurrentValue == "", I(Text("(empty)"))),
If(f.CurrentValue != "", Badge(ColorSuccess, f.CurrentValue)),
If(f.CurrentValue == "", Badge(ColorWarning, "empty")),
InputField(InputFieldParams{
Form: f,
FormField: "Value",
@ -46,7 +47,7 @@ func (f *Cache) Render(r *ui.Request) Node {
Value: f.Value,
}),
ControlGroup(
FormButton("is-link", "Update cache"),
FormButton(ColorPrimary, "Update cache"),
),
CSRF(r),
)

View file

@ -51,7 +51,7 @@ func (f *Contact) Render(r *ui.Request) Node {
Value: f.Message,
}),
ControlGroup(
FormButton("is-link", "Submit"),
FormButton(ColorPrimary, "Submit"),
),
CSRF(r),
)

View file

@ -18,9 +18,13 @@ func (f File) Render(r *ui.Request) Node {
Method(http.MethodPost),
Action(r.Path(routenames.FilesSubmit)),
EncType("multipart/form-data"),
FileField("file", "Choose a file.. "),
FileField(FileFieldParams{
Name: "file",
Label: "Test file",
Help: "Pick a file to upload.",
}),
ControlGroup(
FormButton("is-link", "Upload"),
FormButton(ColorPrimary, "Upload"),
),
CSRF(r),
)

View file

@ -31,8 +31,8 @@ func (f *ForgotPassword) Render(r *ui.Request) Node {
Value: f.Email,
}),
ControlGroup(
FormButton("is-primary", "Reset password"),
ButtonLink(r.Path(routenames.Home), "is-light", "Cancel"),
FormButton(ColorPrimary, "Reset password"),
ButtonLink(ColorLink, r.Path(routenames.Home), "Cancel"),
),
CSRF(r),
)

View file

@ -40,10 +40,25 @@ func (f *Login) Render(r *ui.Request) Node {
Label: "Password",
Placeholder: "******",
}),
Div(
Class("text-right text-primary mt-2"),
A(
Href(r.Path(routenames.ForgotPassword)),
Text("Forgot password?"),
),
),
ControlGroup(
FormButton("is-link", "Login"),
ButtonLink(r.Path(routenames.Home), "is-light", "Cancel"),
FormButton(ColorPrimary, "Login"),
ButtonLink(ColorLink, r.Path(routenames.Home), "Cancel"),
),
CSRF(r),
Div(
Class("text-center text-base-content/50 mt-4"),
Text("Don't have an account? "),
A(
Href(r.Path(routenames.Register)),
Text("Register"),
),
),
)
}

View file

@ -51,16 +51,24 @@ func (f *Register) Render(r *ui.Request) Node {
}),
InputField(InputFieldParams{
Form: f,
FormField: "PasswordConfirm",
FormField: "ConfirmPassword",
Name: "password-confirm",
InputType: "password",
Label: "Confirm password",
Placeholder: "******",
}),
ControlGroup(
FormButton("is-primary", "Register"),
ButtonLink(r.Path(routenames.Home), "is-light", "Cancel"),
FormButton(ColorPrimary, "Register"),
ButtonLink(ColorLink, r.Path(routenames.Home), "Cancel"),
),
CSRF(r),
Div(
Class("text-center text-base-content/50 mt-4"),
Text("Already have an account? "),
A(
Href(r.Path(routenames.Login)),
Text("Login"),
),
),
)
}

View file

@ -39,7 +39,7 @@ func (f *ResetPassword) Render(r *ui.Request) Node {
Placeholder: "******",
}),
ControlGroup(
FormButton("is-primary", "Update password"),
FormButton(ColorPrimary, "Update password"),
),
CSRF(r),
)

View file

@ -42,7 +42,7 @@ func (f *Task) Render(r *ui.Request) Node {
Help: "The message the task will output to the log",
}),
ControlGroup(
FormButton("is-link", "Add task to queue"),
FormButton(ColorPrimary, "Add task to queue"),
),
CSRF(r),
)