Split into category packages; module github.com/ZacharyZhang-NY/MujicaUI
This commit is contained in:
1822 files changed
+24568
-21314
No files matched your search
@@ -3,8 +3,9 @@ package main
|
||||
import (
|
||||
"github.com/egoist/mygo/ui"
|
||||
|
||||
mujica "mujicaui"
|
||||
"mujicaui/theme"
|
||||
"github.com/ZacharyZhang-NY/MujicaUI/core"
|
||||
"github.com/ZacharyZhang-NY/MujicaUI/data"
|
||||
"github.com/ZacharyZhang-NY/MujicaUI/theme"
|
||||
)
|
||||
|
||||
const dataCategory = "Data"
|
||||
@@ -39,18 +40,18 @@ var dataPages = []page{
|
||||
// dataSection lays out a titled block of a demo.
|
||||
func dataSection(c *ui.Context, title string, fn func()) {
|
||||
ui.Column(c).Gap(12).Children(func() {
|
||||
ui.Text(c, title).Font(theme.SerifFont).FontSize(mujica.FontSize(c, theme.H3Size))
|
||||
ui.Text(c, title).Font(theme.SerifFont).FontSize(core.FontSize(c, theme.H3Size))
|
||||
fn()
|
||||
})
|
||||
}
|
||||
|
||||
// dataStates lays labeled variants side by side.
|
||||
func dataStates(c *ui.Context, fn func(state func(name string, body func()))) {
|
||||
k := mujica.Tokens(c)
|
||||
k := core.Tokens(c)
|
||||
ui.Row(c).Gap(24).Wrap().AlignItems(ui.Start).Children(func() {
|
||||
fn(func(name string, body func()) {
|
||||
ui.Column(c).Gap(6).AlignItems(ui.Start).Children(func() {
|
||||
ui.Text(c, name).FontSize(mujica.FontSize(c, theme.CaptionSize)).TextColor(k.TextMuted)
|
||||
ui.Text(c, name).FontSize(core.FontSize(c, theme.CaptionSize)).TextColor(k.TextMuted)
|
||||
body()
|
||||
})
|
||||
})
|
||||
@@ -64,18 +65,18 @@ func dataControls(c *ui.Context, fn func()) {
|
||||
var dataStatuses = []string{"Ready", "Loading", "Loading more", "Failed", "Empty"}
|
||||
|
||||
// dataStatus maps a status choice to the status and whether rows show.
|
||||
func dataStatus(s string) (mujica.DataStatus, bool) {
|
||||
func dataStatus(s string) (data.DataStatus, bool) {
|
||||
switch s {
|
||||
case "Ready":
|
||||
return mujica.DataReady, true
|
||||
return data.DataReady, true
|
||||
case "Loading":
|
||||
return mujica.DataLoading, false
|
||||
return data.DataLoading, false
|
||||
case "Loading more":
|
||||
return mujica.DataLoadingMore, true
|
||||
return data.DataLoadingMore, true
|
||||
case "Failed":
|
||||
return mujica.DataFailed, true
|
||||
return data.DataFailed, true
|
||||
case "Empty":
|
||||
return mujica.DataReady, false
|
||||
return data.DataReady, false
|
||||
}
|
||||
panic("gallery: unknown status " + s)
|
||||
}
|
||||
Reference in new issue
Block a user