-
Notifications
You must be signed in to change notification settings - Fork 11
/
single_action_modal.go
48 lines (41 loc) · 966 Bytes
/
single_action_modal.go
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
package stories
import (
"github.com/maxence-charriere/go-app/v9/pkg/app"
"github.com/pojntfx/keygaen/pkg/components"
)
type SingleActionModalStory struct {
Story
modalOpen bool
}
func (c *SingleActionModalStory) Render() app.UI {
return app.Div().Body(
app.Button().
Class("pf-c-button pf-m-primary").
Type("button").
Text("Open single action modal").
OnClick(func(ctx app.Context, e app.Event) {
c.modalOpen = !c.modalOpen
}),
app.If(
c.modalOpen,
c.WithRoot(
&components.SingleActionModal{
ID: "success-modal-story",
Icon: "fas fa-check",
Title: "Key Successfully Generated!",
Class: "pf-m-success",
Body: "It has been added to the key list.",
ActionLabel: "Continue to key list",
OnClose: func() {
c.modalOpen = false
c.Update()
},
OnAction: func() {
c.modalOpen = false
c.Update()
},
},
),
),
)
}