-
Notifications
You must be signed in to change notification settings - Fork 19
added radio card, progress bar, datepicker #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 16 commits
3864f05
010023d
81589a4
6779876
0d557d5
4be3a2f
aa1da66
6c188ec
820ab23
b570ddf
ac38492
4a11c9d
077913d
c129484
b84aae4
a2304aa
3d6ce48
25befa7
91bcc77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ jobs: | |
|
||
- name: Install templ | ||
run: | | ||
go install github.com/a-h/templ/cmd/[email protected].819 | ||
go install github.com/a-h/templ/cmd/[email protected].856 | ||
templ --help | ||
|
||
- name: Install TailwindCSS | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ FROM golang:1.23.2 | |
WORKDIR /build | ||
|
||
COPY scripts/install.sh . | ||
RUN chmod +x install.sh && ./install.sh && go install github.com/a-h/templ/cmd/[email protected].819 | ||
RUN chmod +x install.sh && ./install.sh && go install github.com/a-h/templ/cmd/[email protected].856 | ||
|
||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.61.0 | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package input | ||
|
||
import "fmt" | ||
import "github.com/iota-uz/iota-sdk/pkg/composables" | ||
|
||
type DatePickerMode string | ||
type DateSelectorType string | ||
|
||
const ( | ||
DatePickerModeSingle = DatePickerMode("single") | ||
DatePickerModeMultiple = DatePickerMode("multiple") | ||
DatePickerModeRange = DatePickerMode("range") | ||
) | ||
|
||
const ( | ||
DateSelectorTypeDay = DateSelectorType("day") | ||
DateSelectorTypeMonth = DateSelectorType("month") | ||
DateSelectorTypeWeek = DateSelectorType("week") | ||
DateSelectorTypeYear = DateSelectorType("year") | ||
) | ||
|
||
type DatePickerProps struct { | ||
Label string | ||
Placeholder string | ||
Mode DatePickerMode | ||
SelectorType DateSelectorType | ||
Attrs templ.Attributes | ||
DateFormat string | ||
LabelFormat string | ||
MinDate string | ||
MaxDate string | ||
Selected []string | ||
Name string | ||
EndName string | ||
StartName string | ||
Form string | ||
} | ||
|
||
templ DatePicker(props DatePickerProps) { | ||
{{ pageCtx := composables.UsePageCtx(ctx) }} | ||
{{ selected, _ := templ.JSONString(props.Selected) }} | ||
<div x-data={ fmt.Sprintf("datePicker({locale: '%s', mode: '%s', dateFormat: '%s', labelFormat: '%s', minDate: '%s', maxDate: '%s', selectorType: '%s', selected: %s})", pageCtx.Locale.String(), props.Mode, props.DateFormat, props.LabelFormat, props.MinDate, props.MaxDate, props.SelectorType, selected) }> | ||
@Text(&Props{ | ||
Label: props.Label, | ||
Placeholder: props.Placeholder, | ||
Attrs: templ.Attributes{ | ||
"x-ref": "input", | ||
}, | ||
}) | ||
if props.Mode == DatePickerModeRange { | ||
<template x-if="selected.length === 2"> | ||
<div class="contents"> | ||
<input | ||
type="hidden" | ||
x-model="selected[0]" | ||
if props.Form != "" { | ||
form={ props.Form } | ||
} | ||
if props.StartName != "" { | ||
name={ props.StartName } | ||
} else { | ||
name={ props.Name } | ||
} | ||
/> | ||
<input | ||
type="hidden" | ||
x-model="selected[1]" | ||
if props.Form != "" { | ||
form={ props.Form } | ||
} | ||
if props.EndName != "" { | ||
name={ props.EndName } | ||
} else { | ||
name={ props.Name } | ||
} | ||
/> | ||
</div> | ||
</template> | ||
} else { | ||
<template x-for="date in selected"> | ||
<input | ||
type="hidden" | ||
name={ props.Name } | ||
x-model="date" | ||
if props.Form != "" { | ||
form={ props.Form } | ||
} | ||
/> | ||
</template> | ||
} | ||
</div> | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this be easier to do with
templ
JSON calling? Like it's done in charts/charts.templ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How?
fmt.Sprintf("datePicker(%s)", templ.JSONString(props))
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, you're not defining the function the same way I do in charts. Event the option you proposed looks better, don't u agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check @diyor28