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
@@ -0,0 +1,32 @@
|
||||
package messaging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/egoist/mygo/ui"
|
||||
|
||||
"github.com/ZacharyZhang-NY/MujicaUI/core"
|
||||
"github.com/ZacharyZhang-NY/MujicaUI/theme"
|
||||
)
|
||||
|
||||
// UnreadDivider marks where unread messages begin; count zero shows "New".
|
||||
func UnreadDivider(c *ui.Context, count int) *ui.Element {
|
||||
if count < 0 {
|
||||
panic("mujica: UnreadDivider count must not be negative")
|
||||
}
|
||||
k := core.Tokens(c)
|
||||
u := core.Density(c).Unit()
|
||||
text := core.Msg(c, "unread_divider.new")
|
||||
if count > 0 {
|
||||
text = fmt.Sprintf(core.Msg(c, "unread_divider.count"), count)
|
||||
}
|
||||
row := ui.Row(c).FillWidth().Gap(u * 2).AlignItems(ui.Center).MinHeight(theme.MinHitSize).Role(ui.RoleStatus).Label(text)
|
||||
row.Children(func() {
|
||||
line := func() { ui.Box(c).Height(1).Grow(1).Background(k.Danger) }
|
||||
line()
|
||||
ui.Text(c, text).FontSize(core.FontSize(c, theme.CaptionSize)).FontWeight(600).TextColor(k.Danger).SingleLine().
|
||||
Padding(0, u*2).Radius(theme.ControlRadius).Border(theme.BorderWidth, k.Danger)
|
||||
line()
|
||||
})
|
||||
return row
|
||||
}
|
||||
Reference in new issue
Block a user