Skip to content

Commit b634823

Browse files
authored
Merge branch 'dev' into main
2 parents 28e227c + 4217191 commit b634823

File tree

284 files changed

+15868
-9784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

284 files changed

+15868
-9784
lines changed

Diff for: assets/css/output.css

+171-64
Large diffs are not rendered by default.

Diff for: cmd/server/main.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ func toastDemoHandler(w http.ResponseWriter, r *http.Request) {
2222
duration = 0
2323
}
2424

25+
fmt.Println("xxx", r.FormValue("description"))
2526
toastProps := components.ToastProps{
26-
Message: r.FormValue("message"),
27-
Type: r.FormValue("type"),
28-
Position: r.FormValue("position"),
29-
Duration: duration,
30-
Size: r.FormValue("size"),
31-
Dismissible: r.FormValue("dismissible") == "on",
32-
Icon: r.FormValue("icon") == "on",
27+
Title: r.FormValue("title"),
28+
Description: r.FormValue("description"),
29+
Variant: components.ToastVariant(r.FormValue("type")),
30+
Position: components.ToastPosition(r.FormValue("position")),
31+
Duration: duration,
32+
Dismissible: r.FormValue("dismissible") == "on",
33+
ShowIndicator: r.FormValue("indicator") == "on",
34+
Icon: r.FormValue("icon") == "on",
3335
}
3436

3537
components.Toast(toastProps).Render(r.Context(), w)
@@ -104,6 +106,7 @@ func main() {
104106
mux.Handle("GET /docs/components/checkbox", templ.Handler(pages.Checkbox()))
105107
mux.Handle("GET /docs/components/checkbox-card", templ.Handler(pages.CheckboxCard()))
106108
mux.Handle("GET /docs/components/date-picker", templ.Handler(pages.DatePicker()))
109+
mux.Handle("GET /docs/components/drawer", templ.Handler(pages.Drawer()))
107110
mux.Handle("GET /docs/components/dropdown-menu", templ.Handler(pages.DropdownMenu()))
108111
mux.Handle("GET /docs/components/form", templ.Handler(pages.Form()))
109112
mux.Handle("GET /docs/components/icon", templ.Handler(pages.Icon()))
@@ -118,14 +121,13 @@ func main() {
118121
mux.Handle("GET /docs/components/rating", templ.Handler(pages.Rating()))
119122
mux.Handle("GET /docs/components/select", templ.Handler(pages.Select()))
120123
mux.Handle("GET /docs/components/separator", templ.Handler(pages.Separator()))
121-
mux.Handle("GET /docs/components/sheet", templ.Handler(pages.Sheet()))
122124
mux.Handle("GET /docs/components/skeleton", templ.Handler(pages.Skeleton()))
123125
mux.Handle("GET /docs/components/slider", templ.Handler(pages.Slider()))
124126
mux.Handle("GET /docs/components/spinner", templ.Handler(pages.Spinner()))
125127
mux.Handle("GET /docs/components/table", templ.Handler(pages.Table()))
126128
mux.Handle("GET /docs/components/tabs", templ.Handler(pages.Tabs()))
127129
mux.Handle("GET /docs/components/textarea", templ.Handler(pages.Textarea()))
128-
mux.Handle("GET /docs/components/time-picker", templ.Handler(pages.TimePicker()))
130+
// mux.Handle("GET /docs/components/time-picker", templ.Handler(pages.TimePicker()))
129131
mux.Handle("GET /docs/components/toast", templ.Handler(pages.Toast()))
130132
mux.Handle("GET /docs/components/toggle", templ.Handler(pages.Toggle()))
131133
mux.Handle("GET /docs/components/tooltip", templ.Handler(pages.Tooltip()))

Diff for: components/accordion.templ

+70-40
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,84 @@ import (
55
"github.com/axzilla/templui/utils"
66
)
77

8-
type AccordionItem struct {
9-
ID string // Unique identifier for state management
10-
Trigger templ.Component // Header content that toggles section
11-
Content templ.Component // Expandable section content
8+
type AccordionProps struct {
9+
ID string
10+
Class string
11+
Attributes templ.Attributes
1212
}
1313

14-
// AccordionProps configures the Accordion component
15-
type AccordionProps struct {
16-
Items []AccordionItem // Array of accordion sections
17-
Class string // Additional CSS classes
18-
Attributes templ.Attributes // Additional HTML attributes
14+
type AccordionItemProps struct {
15+
ID string
16+
Class string
17+
Attributes templ.Attributes
18+
Value string
19+
}
20+
21+
type AccordionTriggerProps struct {
22+
ID string
23+
Class string
24+
Attributes templ.Attributes
25+
}
26+
27+
type AccordionContentProps struct {
28+
ID string
29+
Class string
30+
Attributes templ.Attributes
1931
}
2032

2133
templ Accordion(props AccordionProps) {
2234
<div
2335
class={ utils.TwMerge(
24-
"divide-y rounded-md divide-border border",
25-
props.Class,
26-
) }
36+
"divide-y rounded-md divide-border border",
37+
props.Class,
38+
) }
39+
{ props.Attributes... }
40+
>
41+
{ children... }
42+
</div>
43+
}
44+
45+
templ AccordionItem(props AccordionItemProps) {
46+
<details
47+
name="accordion"
48+
class={ utils.TwMerge(
49+
"group",
50+
"open:[&>summary_svg]:rotate-180",
51+
props.Class,
52+
) }
53+
data-value={ props.Value }
54+
{ props.Attributes... }
55+
>
56+
{ children... }
57+
</details>
58+
}
59+
60+
templ AccordionTrigger(props AccordionTriggerProps) {
61+
<summary
62+
class={ utils.TwMerge(
63+
"flex w-full items-center justify-between py-4 px-5",
64+
"text-left font-medium cursor-pointer",
65+
"transition-all hover:underline",
66+
"list-none [&::-webkit-details-marker]:hidden",
67+
props.Class,
68+
) }
69+
{ props.Attributes... }
70+
>
71+
<div class="flex-1">
72+
{ children... }
73+
</div>
74+
@icons.ChevronDown(icons.IconProps{Size: "16", Class: "transition-transform"})
75+
</summary>
76+
}
77+
78+
templ AccordionContent(props AccordionContentProps) {
79+
<div
80+
class={ utils.TwMerge(
81+
"px-5 pb-4 pt-0",
82+
props.Class,
83+
) }
2784
{ props.Attributes... }
2885
>
29-
for _, item := range props.Items {
30-
<details
31-
name="accordion"
32-
class={ utils.TwMerge(
33-
"group",
34-
"open:[&>summary_svg]:rotate-180",
35-
) }
36-
>
37-
<summary
38-
class={ utils.TwMerge(
39-
"flex w-full items-center justify-between py-4 px-5",
40-
"text-left font-medium cursor-pointer",
41-
"transition-all hover:underline",
42-
"list-none [&::-webkit-details-marker]:hidden",
43-
) }
44-
>
45-
@item.Trigger
46-
@icons.ChevronDown(icons.IconProps{Size: "16", Class: "transition-transform"})
47-
</summary>
48-
<div
49-
class={ utils.TwMerge(
50-
"px-5 pb-4 pt-0",
51-
) }
52-
>
53-
@item.Content
54-
</div>
55-
</details>
56-
}
86+
{ children... }
5787
</div>
5888
}

0 commit comments

Comments
 (0)