-
Notifications
You must be signed in to change notification settings - Fork 6
/
repopack-output.txt
9950 lines (8967 loc) · 284 KB
/
repopack-output.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
This file is a merged representation of the entire codebase, combining all repository files into a single document.
Generated by Repopack on: 2024-11-21T07:38:46.975Z
================================================================
File Summary
================================================================
Purpose:
--------
This file contains a packed representation of the entire repository's contents.
It is designed to be easily consumable by AI systems for analysis, code review,
or other automated processes.
File Format:
------------
The content is organized as follows:
1. This summary section
2. Repository information
3. Repository structure
4. Multiple file entries, each consisting of:
a. A separator line (================)
b. The file path (File: path/to/file)
c. Another separator line
d. The full contents of the file
e. A blank line
Usage Guidelines:
-----------------
- This file should be treated as read-only. Any changes should be made to the
original repository files, not this packed version.
- When processing this file, use the file path to distinguish
between different files in the repository.
- Be aware that this file may contain sensitive information. Handle it with
the same level of security as you would the original repository.
Notes:
------
- Some files may have been excluded based on .gitignore rules and Repopack's
configuration.
- Binary files are not included in this packed representation. Please refer to
the Repository Structure section for a complete list of file paths, including
binary files.
Additional Info:
----------------
For more information about Repopack, visit: https://github.com/yamadashy/repopack
================================================================
Repository Structure
================================================================
cmd/
icongen/
main.go
server/
main.go
internals/
config/
config.go
shared/
menudata.go
ui/
layouts/
base.templ
docs.templ
pages/
accordion.templ
alert.templ
avatar.templ
button.templ
card.templ
checkbox.templ
datepicker.templ
dropdown_menu.templ
form.templ
how_to_use.templ
icon.templ
input.templ
introduction.templ
landing.templ
modal.templ
radio_group.templ
select.templ
sheet.templ
tabs.templ
themes.templ
toggle.templ
showcase/
accordion.templ
alert.templ
avatar.templ
button.templ
card.templ
checkbox.templ
datepicker.templ
dropdown_menu.templ
embed.go
form.templ
icon.templ
input.templ
modal.templ
radio_group.templ
select.templ
sheet.templ
tabs.templ
toggle.templ
pkg/
components/
accordion.templ
alert.templ
avatar.templ
button.templ
card.templ
checkbox.templ
datepicker.templ
dropdown_menu.templ
embed.go
footer.templ
form.templ
input.templ
modal.templ
navbar.templ
radio_group.templ
select.templ
sheet.templ
sidebar_right.templ
sidebar.templ
tabs.templ
themeswitcher.templ
toggle.templ
icons/
embed.go
icon_defs.go
icons.go
styles/
goilerplate.css
utils/
utils.go
.dockerignore
.env.example
.gitignore
CHEATSHEET.md
CONTRIBUTING.md
Dockerfile
go.mod
go.sum
LICENSE
Makefile
README.md
tailwind.config.js
tailwind.config.lib.js
================================================================
Repository Files
================================================================
================
File: cmd/icongen/main.go
================
package main
import (
"fmt"
"os"
"path/filepath"
"strings"
)
const (
iconDir = "./lucide/icons" // Path to the Lucide SVG files
outputFile = "./pkg/icons/icon_defs.go"
iconContentDir = "./pkg/icons/content" // Directory for individual icon contents
)
func main() {
// Read all files from the icon directory
files, err := os.ReadDir(iconDir)
if err != nil {
panic(err)
}
// Initialize slice for icon definitions
var iconDefs []string
iconDefs = append(iconDefs, "package icons\n")
iconDefs = append(iconDefs, "// This file is auto generated\n")
// Create the content directory if it doesn't exist
err = os.MkdirAll(iconContentDir, os.ModePerm)
if err != nil {
panic(err)
}
// Process each SVG file
for _, file := range files {
if filepath.Ext(file.Name()) == ".svg" {
name := strings.TrimSuffix(file.Name(), ".svg")
funcName := toPascalCase(name)
// Add icon definition
iconDefs = append(iconDefs, fmt.Sprintf("var %s = Icon(%q)\n", funcName, name))
// Save icon content to a separate file
content, err := os.ReadFile(filepath.Join(iconDir, file.Name()))
if err != nil {
panic(err)
}
err = os.WriteFile(filepath.Join(iconContentDir, name+".svg"), content, 0644)
if err != nil {
panic(err)
}
}
}
// Write all icon definitions to the output file
err = os.WriteFile(outputFile, []byte(strings.Join(iconDefs, "")), 0644)
if err != nil {
panic(err)
}
fmt.Println("Icon definitions and contents generated successfully!")
}
// toPascalCase converts a kebab-case string to PascalCase
func toPascalCase(s string) string {
words := strings.Split(s, "-")
for i, word := range words {
words[i] = strings.Title(word)
}
return strings.Join(words, "")
}
================
File: cmd/server/main.go
================
package main
import (
"fmt"
"net/http"
"github.com/a-h/templ"
"github.com/axzilla/goilerplate/assets"
"github.com/axzilla/goilerplate/internals/config"
"github.com/axzilla/goilerplate/internals/ui/pages"
)
func main() {
mux := http.NewServeMux()
config.LoadConfig()
SetupAssetsRoutes(mux)
mux.Handle("GET /", templ.Handler(pages.Landing()))
mux.Handle("GET /docs/components", http.RedirectHandler("/docs/components/accordion", http.StatusSeeOther))
mux.Handle("GET /docs/getting-started", http.RedirectHandler("/docs/introduction", http.StatusSeeOther))
mux.Handle("GET /docs/introduction", templ.Handler(pages.Introduction()))
mux.Handle("GET /docs/how-to-use", templ.Handler(pages.HowToUse()))
mux.Handle("GET /docs/themes", templ.Handler(pages.Themes()))
// Components
mux.Handle("GET /docs/components/accordion", templ.Handler(pages.Accordion()))
mux.Handle("GET /docs/components/alert", templ.Handler(pages.Alert()))
mux.Handle("GET /docs/components/avatar", templ.Handler(pages.Avatar()))
mux.Handle("GET /docs/components/button", templ.Handler(pages.Button()))
mux.Handle("GET /docs/components/card", templ.Handler(pages.Card()))
mux.Handle("GET /docs/components/checkbox", templ.Handler(pages.Checkbox()))
mux.Handle("GET /docs/components/datepicker", templ.Handler(pages.Datepicker()))
mux.Handle("GET /docs/components/dropdown-menu", templ.Handler(pages.DropdownMenu()))
mux.Handle("GET /docs/components/form", templ.Handler(pages.Form()))
mux.Handle("GET /docs/components/icon", templ.Handler(pages.Icon()))
mux.Handle("GET /docs/components/input", templ.Handler(pages.Input()))
mux.Handle("GET /docs/components/modal", templ.Handler(pages.Modal()))
mux.Handle("GET /docs/components/radio-group", templ.Handler(pages.RadioGroup()))
mux.Handle("GET /docs/components/select", templ.Handler(pages.Select()))
mux.Handle("GET /docs/components/sheet", templ.Handler(pages.Sheet()))
mux.Handle("GET /docs/components/tabs", templ.Handler(pages.Tabs()))
mux.Handle("GET /docs/components/toggle", templ.Handler(pages.Toggle()))
fmt.Println("Server is running on http://localhost:8090")
http.ListenAndServe(":8090", mux)
}
func SetupAssetsRoutes(mux *http.ServeMux) {
var isDevelopment = config.AppConfig.GoEnv != "production"
// We need this for Templ to work
disableCacheInDevMode := func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if isDevelopment {
w.Header().Set("Cache-Control", "no-store")
}
next.ServeHTTP(w, r)
})
}
// Serve static files from the assets directory
var fs http.Handler
if isDevelopment {
fs = http.FileServer(http.Dir("./assets"))
} else {
fs = http.FileServer(http.FS(assets.Assets))
}
mux.Handle("GET /assets/*", disableCacheInDevMode(http.StripPrefix("/assets/", fs)))
}
================
File: internals/config/config.go
================
package config
import (
"fmt"
"log"
"os"
"github.com/joho/godotenv"
)
type Config struct {
GoEnv string
}
var AppConfig *Config
func LoadConfig() {
err := godotenv.Load()
if err != nil {
fmt.Println("Error loading .env file")
} else {
log.Println(".env file initialized.")
}
AppConfig = &Config{
GoEnv: os.Getenv("GO_ENV"),
}
}
================
File: internals/shared/menudata.go
================
package shared
type SideLink struct {
Text string
Href string
Icon string
Click string
}
type Section struct {
Title string
Links []SideLink
}
var Sections = []Section{
{
Title: "Getting Started",
Links: []SideLink{
{
Text: "Introduction",
Href: "/docs/introduction",
},
{
Text: "How to Use",
Href: "/docs/how-to-use",
},
{
Text: "Themes",
Href: "/docs/themes",
},
},
},
{
Title: "Components",
Links: []SideLink{
{
Text: "Accordion",
Href: "/docs/components/accordion",
},
{
Text: "Alert",
Href: "/docs/components/alert",
},
{
Text: "Avatar",
Href: "/docs/components/avatar",
},
{
Text: "Button",
Href: "/docs/components/button",
},
{
Text: "Card",
Href: "/docs/components/card",
},
{
Text: "Checkbox",
Href: "/docs/components/checkbox",
},
{
Text: "Datepicker",
Href: "/docs/components/datepicker",
},
{
Text: "Dropdown Menu",
Href: "/docs/components/dropdown-menu",
},
{
Text: "Form",
Href: "/docs/components/form",
},
{
Text: "Icon",
Href: "/docs/components/icon",
},
{
Text: "Input",
Href: "/docs/components/input",
},
{
Text: "Modal",
Href: "/docs/components/modal",
},
{
Text: "Radio Group",
Href: "/docs/components/radio-group",
},
{
Text: "Select",
Href: "/docs/components/select",
},
{
Text: "Sheet",
Href: "/docs/components/sheet",
},
{
Text: "Tabs",
Href: "/docs/components/tabs",
},
{
Text: "Toggle",
Href: "/docs/components/toggle",
},
},
},
}
================
File: internals/ui/layouts/base.templ
================
package layouts
import "github.com/axzilla/goilerplate/internals/config"
templ BaseLayout() {
<!DOCTYPE html>
<html lang="en" class="h-full">
<head>
<title>Goilerplate - Modern UI Components for Go & Templ</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
/* Hide the page initially */
.page-loader { display: none; }
html.pre-load .page-loader { display: block; }
html.pre-load body { display: none; }
</style>
<script>
// Immediately set theme and remove pre-load class
(function() {
document.documentElement.classList.add('pre-load');
var appTheme = localStorage.getItem('appTheme') || 'light';
document.documentElement.classList.toggle('dark', appTheme === 'dark');
document.addEventListener('DOMContentLoaded', function() {
document.documentElement.classList.remove('pre-load');
});
})();
</script>
if config.AppConfig.GoEnv == "production" {
<!-- Plausible Analytics -->
<script defer data-domain="goilerplate.com" src="https://plausible.axeladrian.com/js/script.js"></script>
}
<!-- Favicon -->
<link rel="icon" href="/assets/img/gopher.svg" type="image/x-icon"/>
<!-- Tailwind CSS (local) -->
<link href="/assets/css/output.css" rel="stylesheet"/>
<!-- Alpine.js -->
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/[email protected]/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
// Theme Customizer
<script src="/assets/js/theme-customizer.js"></script>
<!-- Themes CSS -->
<link href="/assets/css/themes.css" rel="stylesheet"/>
<!-- Highlight.js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/base16/woodland.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/go.min.js"></script>
<script>hljs.highlightAll();</script>
</head>
<body
x-data="{
appTheme: localStorage.getItem('appTheme') || 'light',
sidebarOpen: false,
toggleTheme() {
this.appTheme = this.appTheme === 'dark' ? 'light' : 'dark';
localStorage.setItem('appTheme', this.appTheme);
document.documentElement.classList.toggle('dark', this.appTheme === 'dark');
}
}"
class="h-full flex flex-col transition-colors duration-200"
:class="{'bg-white text-black': appTheme === 'light', 'text-white': appTheme === 'dark'}"
>
<div class="flex flex-col min-h-screen">
{ children... }
</div>
</body>
</html>
}
================
File: internals/ui/layouts/docs.templ
================
package layouts
import "github.com/axzilla/goilerplate/pkg/components"
templ DocsLayout() {
@BaseLayout() {
<div class="flex flex-col h-screen">
<div class="flex-shrink-0">
@components.Navbar()
</div>
<div class="flex flex-1 overflow-hidden">
<div class="hidden lg:block border-r overflow-y-auto h-full">
@components.Sidebar()
</div>
<main class="flex-1 overflow-y-auto h-full">
<div class="container max-w-3xl mx-auto px-4 py-8">
{ children... }
</div>
</main>
<div class="hidden lg:block border-l overflow-y-auto h-full">
@components.SidebarRight()
</div>
</div>
</div>
@components.Footer()
}
}
================
File: internals/ui/pages/accordion.templ
================
package pages
import (
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
"github.com/axzilla/goilerplate/pkg/components"
)
templ Accordion() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Accordion</h1>
<p class="mb-4 text-muted-foreground">A vertically stacked set of interactive headings that each reveal a section of content.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.AccordionShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("accordion.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("accordion.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
================
File: internals/ui/pages/alert.templ
================
package pages
import (
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
"github.com/axzilla/goilerplate/pkg/components"
)
templ Alert() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Alert</h1>
<p class="mb-4 text-muted-foreground">Displays a callout for user attention, often used for notifications, warnings, or important messages.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.AlertShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("alert.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("alert.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
================
File: internals/ui/pages/avatar.templ
================
package pages
import (
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
"github.com/axzilla/goilerplate/pkg/components"
)
templ Avatar() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Avatar</h1>
<p class="mb-4 text-muted-foreground">An image element with a fallback for representing the user.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.AvatarShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("avatar.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("avatar.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
================
File: internals/ui/pages/button.templ
================
package pages
import (
"embed"
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
"github.com/axzilla/goilerplate/pkg/components"
)
templ Button() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Button</h1>
<p class="mb-4 text-muted-foreground">Displays a button or a component that looks like a button.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.ButtonShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("button.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("button.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
templ CodeSnippetFromEmbedded(filename, language string, embed embed.FS) {
if content, err := embed.ReadFile(filename); err != nil {
<div class="error">Error reading file: { filename }: { err.Error() }</div>
} else {
@CodeSnippet(string(content), language)
}
}
templ CodeSnippet(content, language string) {
<div class="relative" x-data="{ copied: false }">
<pre class="!overflow-hidden">
<code x-ref="code" class={ "language-" + language, "!max-h-[501px] !overflow-y-auto rounded-md block" }>
{ content }
</code>
</pre>
<button
class="absolute top-2 right-2 bg-gray-700 hover:bg-gray-600 text-white font-bold py-1 px-2 rounded text-xs"
x-on:click="
navigator.clipboard.writeText($refs.code.textContent);
copied = true;
setTimeout(() => copied = false, 2001);
"
x-text="copied ? 'Copied!' : 'Copy'"
></button>
</div>
}
================
File: internals/ui/pages/card.templ
================
package pages
import (
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
"github.com/axzilla/goilerplate/pkg/components"
)
templ Card() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Card</h1>
<p class="mb-4 text-muted-foreground">Displays a card with header, content, and footer.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.CardShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("card.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("card.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
================
File: internals/ui/pages/checkbox.templ
================
package pages
import (
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
"github.com/axzilla/goilerplate/pkg/components"
)
templ Checkbox() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Checkbox</h1>
<p class="mb-4 text-muted-foreground">A control that allows the user to toggle between checked and not checked.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.CheckboxShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("checkbox.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("checkbox.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
================
File: internals/ui/pages/datepicker.templ
================
package pages
import (
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
"github.com/axzilla/goilerplate/pkg/components"
)
templ Datepicker() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Datepicker</h1>
<p class="mb-4 text-muted-foreground">A date picker component.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.DatepickerShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("datepicker.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("datepicker.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
================
File: internals/ui/pages/dropdown_menu.templ
================
package pages
import (
"github.com/axzilla/goilerplate/pkg/components"
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
)
templ DropdownMenu() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Dropdown Menu</h1>
<p class="mb-4 text-muted-foreground">The Dropdown Menu component provides a way to display a list of options in a compact form.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.DropdownMenuShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("dropdown_menu.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("dropdown_menu.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
================
File: internals/ui/pages/form.templ
================
package pages
import (
"github.com/axzilla/goilerplate/internals/ui/layouts"
"github.com/axzilla/goilerplate/internals/ui/showcase"
"github.com/axzilla/goilerplate/pkg/components"
)
templ Form() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">Form</h1>
<p class="mb-4 text-muted-foreground">Building forms with Go, Templ & Alpine.js.</p>
</div>
@components.Tabs(components.TabsProps{
Tabs: []components.Tab{
{
ID: "preview",
Title: "Preview",
Content: showcase.FormShowcase(),
},
{
ID: "code",
Title: "Code",
Content: CodeSnippetFromEmbedded("form.templ", "go", showcase.TemplFiles),
},
{
ID: "component",
Title: "Component",
Content: CodeSnippetFromEmbedded("form.templ", "go", components.TemplFiles),
},
},
TabsContainerClass: "md:w-1/2",
ContentContainerClass: "w-full",
})
</div>
}
}
================
File: internals/ui/pages/how_to_use.templ
================
package pages
import "github.com/axzilla/goilerplate/internals/ui/layouts"
templ HowToUse() {
@layouts.DocsLayout() {
<div>
<div class="mb-16">
<h1 class="text-3xl font-bold mb-2">How To Use</h1>
<p class="mb-4 text-muted-foreground">Learn how to integrate Goilerplate into your projects.</p>
</div>
<section class="mb-12">
<h2 class="text-2xl font-semibold mb-4 text-primary">Two Ways to Use Goilerplate</h2>
<p class="mb-4">
Goilerplate offers flexibility in how you can integrate it into your projects. There are two main approaches:
</p>
<div class="mb-8">
<h3 class="text-xl font-semibold mb-2">1. Use as a Package Library</h3>
<p class="mb-4">
Install Goilerplate as a Go package and import components as needed:
</p>
<pre>
<code>
{ `go get github.com/axzilla/goilerplate
// In your Go files
import "github.com/axzilla/goilerplate/pkg/components"
// In your Templ files
@components.Button(components.ButtonProps{Text: "Click me"})` }