You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.7 KiB
Go

package main
import (
"time"
"git.d3nexus.de/Dadido3/D3vugu-components/components/input"
"git.d3nexus.de/Dadido3/D3vugu-components/components/overlay"
"git.d3nexus.de/Dadido3/D3vugu-components/icons"
"github.com/vugu/vugu"
)
type PageOverlays struct {
overlay.OverlayContainerRef
}
func (c *PageOverlays) handleSimpleModalButton(event vugu.DOMEvent) {
c.SetModal(&overlay.ModalRequester{
IconSlot: &icons.LInfoCircle{AttrMap: vugu.AttrMap{"style": "font-size: 2em;"}},
Title: "Simple requester",
Message: "This is a simple modal requester, are you happy with it?\nIt also supports multi line text!",
SignalColor: "d3c-color-attention",
ClickAbort: input.ClickFunc(func(event input.ClickEvent) {}),
ClickYes: input.ClickFunc(func(event input.ClickEvent) {}),
})
}
func (c *PageOverlays) handleSimpleToastButton(event vugu.DOMEvent) {
c.AddToast(&overlay.ToastSimple{
IconSlot: &icons.LInfoCircle{AttrMap: vugu.AttrMap{"style": "font-size: 2em;"}},
Message: "This is a simple toast!\nIt supports multiple lines and has an icon slot.\nThere also can be multiple of it at the same time, this one was opened at " + time.Now().Format(time.TimeOnly) + ".",
SignalColor: "d3c-color-attention",
})
}
func (c *PageOverlays) handleWarningToastButton(event vugu.DOMEvent) {
c.AddToast(&overlay.ToastSimple{
IconSlot: &icons.LWarning{AttrMap: vugu.AttrMap{"style": "font-size: 2em;", "class": "d3c-color-caution d3c-icon-use-color"}},
Message: "This is a warning, be careful!",
SignalColor: "d3c-color-caution",
})
}
func (c *PageOverlays) handleToastMessageButton(event vugu.DOMEvent) {
c.AddToast(&overlay.ToastMessage{MessageType: overlay.ToastMessageTypeCritical, Message: "Uh oh!"})
}