forked from goffee/core
add ID to button
This commit is contained in:
parent
8950cb539a
commit
5896e6e617
4 changed files with 16 additions and 10 deletions
|
@ -1,6 +1,8 @@
|
||||||
package components
|
package components
|
||||||
|
|
||||||
type FormButton struct {
|
type FormButton struct {
|
||||||
|
ID string
|
||||||
|
Value string
|
||||||
Text string
|
Text string
|
||||||
Icon string
|
Icon string
|
||||||
IsSubmit bool
|
IsSubmit bool
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{define "form_button"}}
|
{{define "form_button"}}
|
||||||
<button class="btn btn-{{.TypeClass}}" {{if eq .IsSubmit true}}type="submit"{{else}}type="button"{{end}} {{if .IsDisabled}}disabled{{end}}>
|
<button {{if .ID }}id="{{.ID}}" name="{{.ID}}"{{end}} {{if .Value }}value="{{.Value}}" name="{{.ID}}"{{end}} class="btn btn-{{.TypeClass}}" {{if eq .IsSubmit true}}type="submit"{{else}}type="button"{{end}} {{if .IsDisabled}}disabled{{end}}>
|
||||||
{{.Text}}
|
{{.Text}}
|
||||||
</button>
|
</button>
|
||||||
<!-- tailwind heroicons -->
|
<!-- tailwind heroicons -->
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package components
|
package components
|
||||||
|
|
||||||
type FormInput struct {
|
type FormInput struct {
|
||||||
ID string
|
ID string
|
||||||
Label string
|
Label string
|
||||||
Type string
|
Type string
|
||||||
Placeholder string
|
Placeholder string
|
||||||
Value string
|
Value string
|
||||||
Hint string
|
Hint string
|
||||||
Error string
|
Error string
|
||||||
IsDisabled bool
|
IsDisabled bool
|
||||||
IsRequired bool
|
Autocomplete bool
|
||||||
|
IsRequired bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
{{if eq .IsRequired true}}
|
{{if eq .IsRequired true}}
|
||||||
required
|
required
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if eq .Autocomplete false}}
|
||||||
|
autocomplete="off"
|
||||||
|
{{end}}
|
||||||
{{if ne .Value ""}}
|
{{if ne .Value ""}}
|
||||||
value="{{.Value}}"
|
value="{{.Value}}"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
Loading…
Reference in a new issue