Foundation: tokens, theme, icons, i18n, Button, Spinner, gallery scaffold

This commit is contained in:
ZacharyZhang-NY committed 2026-10-05 11:59:19 -04:00
commit 119f9047e9
95 files changed
+2489

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
package main
import (
"github.com/egoist/mygo/ui"
mujica "mujicaui"
)
type gallery struct {
pages []page
selected int
events []string
}
func newGallery() *gallery { return &gallery{pages: catalog()} }
func (g *gallery) log(s string) { g.events = append(g.events, s) }
func (g *gallery) view(c *ui.Context) {
mujica.Use(c, mujica.Settings{})
ui.Row(c).Fill().Children(func() {
ui.Scroll(c).Width(240).FillHeight().Children(func() {
for i, p := range g.pages {
if mujica.Button(c, p.ID+" "+p.Name, mujica.ButtonOptions{Variant: mujica.Ghost}).Key(p.ID).Clicked() {
g.selected = i
}
}
})
ui.Scroll(c).Fill().Padding(24).Children(func() {
if len(g.pages) > 0 {
g.pages[g.selected].Demo(c, g.log)
}
})
})
}
+23
View File
@@ -0,0 +1,23 @@
package main
import "github.com/egoist/mygo/ui"
// page is one component's gallery entry.
type page struct {
ID string
Name string
ZhName string
Category string
// Demo builds the interactive example; log records events.
Demo func(c *ui.Context, log func(string))
Code string
Keys string
}
func catalog() []page {
var all []page
for _, g := range [][]page{layoutPages, displayPages, inputPages, choicePages, formPages, datetimePages, navigationPages, dataPages, overlayPages, feedbackPages} {
all = append(all, g...)
}
return all
}
+28
View File
@@ -0,0 +1,28 @@
// Gallery tours every MujicaUI component in a native MyGo window.
//
// go run ./examples/gallery
package main
import (
"log"
"github.com/egoist/mygo"
"github.com/egoist/mygo/ui"
)
func main() {
app := newGallery()
mygo.App.WhenReady(func() {
mygo.NewWindow(mygo.WindowOptions{
Title: "MujicaUI Gallery",
Width: 1200,
Height: 800,
MinWidth: 800,
MinHeight: 600,
Content: ui.View(app.view),
})
})
if err := mygo.App.Run(); err != nil {
log.Fatal(err)
}
}
+3
View File
@@ -0,0 +1,3 @@
package main
var choicePages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var dataPages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var datetimePages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var displayPages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var feedbackPages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var formPages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var inputPages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var layoutPages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var navigationPages = []page{}
+3
View File
@@ -0,0 +1,3 @@
package main
var overlayPages = []page{}