Remove sidebar body overlay when menu is minimized
This commit is contained in:
parent
4b910047e0
commit
8c96378190
@ -12,7 +12,7 @@ type Sidebar struct {
|
|||||||
|
|
||||||
Minimized bool `vugu:"data"` // If true, the sidebar is reduced to icons.
|
Minimized bool `vugu:"data"` // If true, the sidebar is reduced to icons.
|
||||||
sidebarClasses string
|
sidebarClasses string
|
||||||
bodyOverlayStyle string
|
showBodyOverlay bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Sidebar) Init(ctx vugu.InitCtx) {
|
func (c *Sidebar) Init(ctx vugu.InitCtx) {
|
||||||
@ -22,10 +22,10 @@ func (c *Sidebar) Init(ctx vugu.InitCtx) {
|
|||||||
func (c *Sidebar) Compute(ctx vugu.ComputeCtx) {
|
func (c *Sidebar) Compute(ctx vugu.ComputeCtx) {
|
||||||
if c.Minimized {
|
if c.Minimized {
|
||||||
c.sidebarClasses = "d3c-1633357633-sidebar-minimized"
|
c.sidebarClasses = "d3c-1633357633-sidebar-minimized"
|
||||||
c.bodyOverlayStyle = "display: none;"
|
c.showBodyOverlay = false
|
||||||
} else {
|
} else {
|
||||||
c.sidebarClasses = ""
|
c.sidebarClasses = ""
|
||||||
c.bodyOverlayStyle = ""
|
c.showBodyOverlay = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d3c-1633357633-body">
|
<div class="d3c-1633357633-body">
|
||||||
<div class="d3c-1633357633-body-overlay" :style="c.bodyOverlayStyle" @click="c.handleOverlayClick(event)">
|
<div vg-if="c.showBodyOverlay" class="d3c-1633357633-body-overlay" @click="c.handleOverlayClick(event)">
|
||||||
</div>
|
</div>
|
||||||
<div class="d3c-1633357633-menu d3c-color-layer-1">
|
<div class="d3c-1633357633-menu d3c-color-layer-1">
|
||||||
<input:Button @Click="c.handleMenuButton(event)">
|
<input:Button @Click="c.handleMenuButton(event)">
|
||||||
@ -43,6 +43,7 @@
|
|||||||
border-bottom: 1px solid var(--d3c-color-border);
|
border-bottom: 1px solid var(--d3c-color-border);
|
||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
gap: 0.5em;
|
||||||
padding: 0 0.5em;
|
padding: 0 0.5em;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: var(--d3c-color-background);
|
background-color: var(--d3c-color-background);
|
||||||
|
@ -155,9 +155,9 @@ func (c *Sidebar) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
|
|||||||
_ = vgparent
|
_ = vgparent
|
||||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
|
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
|
||||||
vgparent.AppendChild(vgn)
|
vgparent.AppendChild(vgn)
|
||||||
|
if c.showBodyOverlay {
|
||||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1633357633-body-overlay"}}}
|
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1633357633-body-overlay"}}}
|
||||||
vgparent.AppendChild(vgn)
|
vgparent.AppendChild(vgn)
|
||||||
vgn.AddAttrInterface("style", c.bodyOverlayStyle)
|
|
||||||
vgn.DOMEventHandlerSpecList = append(vgn.DOMEventHandlerSpecList, vugu.DOMEventHandlerSpec{
|
vgn.DOMEventHandlerSpecList = append(vgn.DOMEventHandlerSpecList, vugu.DOMEventHandlerSpec{
|
||||||
EventType: "click",
|
EventType: "click",
|
||||||
Func: func(event vugu.DOMEvent) { c.handleOverlayClick(event) },
|
Func: func(event vugu.DOMEvent) { c.handleOverlayClick(event) },
|
||||||
@ -169,6 +169,7 @@ func (c *Sidebar) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
|
|||||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
|
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
|
||||||
vgparent.AppendChild(vgn)
|
vgparent.AppendChild(vgn)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
|
vgn = &vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t\t"}
|
||||||
vgparent.AppendChild(vgn)
|
vgparent.AppendChild(vgn)
|
||||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1633357633-menu d3c-color-layer-1"}}}
|
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Namespace: "", Data: "div", Attr: []vugu.VGAttribute{vugu.VGAttribute{Namespace: "", Key: "class", Val: "d3c-1633357633-menu d3c-color-layer-1"}}}
|
||||||
@ -249,7 +250,7 @@ func (c *Sidebar) Build(vgin *vugu.BuildIn) (vgout *vugu.BuildOut) {
|
|||||||
}
|
}
|
||||||
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "style", Attr: []vugu.VGAttribute(nil)}
|
vgn = &vugu.VGNode{Type: vugu.VGNodeType(3), Data: "style", Attr: []vugu.VGAttribute(nil)}
|
||||||
{
|
{
|
||||||
vgn.AppendChild(&vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t.d3c-1633357633 {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tposition: absolute;\n\t\tdisplay: flex;\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t}\n\n\t.d3c-1633357633-menu {\n\t\twidth: 100%;\n\t\tborder-bottom: 1px solid var(--d3c-color-border);\n\t\tdisplay: flex;\n\t\tposition: relative;\n\t\tpadding: 0 0.5em;\n\t\tbox-sizing: border-box;\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t}\n\n\t.d3c-1633357633-sidebar {\n\t\theight: 100%;\n\t\tborder-right: 1px solid var(--d3c-color-border);\n\t\tpadding: 0 0.5em;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t\tz-index: 1;\n\t}\n\n\t.d3c-1633357633-sidebar-menu {\n\t\t/*display: flex;\n\t\tflex-direction: column;*/\n\t}\n\n\t@media (min-aspect-ratio: 1/1) {\n\t\t.d3c-1633357633-menu, .d3c-1633357633-body-overlay {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\t@media not all and (min-aspect-ratio: 1/1) {\n\t\t.d3c-1633357633-sidebar-minimized {\n\t\t\tdisplay: none;\n\t\t}\n\t\t.d3c-1633357633-sidebar {\n\t\t\tposition: absolute;\n\t\t}\n\t}\n\n\t.d3c-1633357633-sidebar-entries {\n\t\toverflow-y: scroll;\n\t}\n\n\t.d3c-1633357633-sidebar-entries > * {\n\t\twidth: 100%;\n\t}\n\n\t.d3c-1633357633-bottom-entries > * {\n\t\twidth: 100%;\n\t}\n\n\t.d3c-1633357633-spacer {\n\t\tflex-grow: 1;\n\t}\n\n\t.d3c-1633357633-body {\n\t\toverflow: auto;\n\t\tflex-grow: 1;\n\t\tflex-shrink: 1;\n\t}\n\n\t.d3c-1633357633-body-overlay {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tposition: fixed;\n\t\t/*backdrop-filter: blur(1px);*/\n\t}\n", Attr: []vugu.VGAttribute(nil)})
|
vgn.AppendChild(&vugu.VGNode{Type: vugu.VGNodeType(1), Data: "\n\t.d3c-1633357633 {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tposition: absolute;\n\t\tdisplay: flex;\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t}\n\n\t.d3c-1633357633-menu {\n\t\twidth: 100%;\n\t\tborder-bottom: 1px solid var(--d3c-color-border);\n\t\tdisplay: flex;\n\t\tposition: relative;\n\t\tgap: 0.5em;\n\t\tpadding: 0 0.5em;\n\t\tbox-sizing: border-box;\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t}\n\n\t.d3c-1633357633-sidebar {\n\t\theight: 100%;\n\t\tborder-right: 1px solid var(--d3c-color-border);\n\t\tpadding: 0 0.5em;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tbackground-color: var(--d3c-color-background);\n\t\tcolor: var(--d3c-color-text);\n\t\tz-index: 1;\n\t}\n\n\t.d3c-1633357633-sidebar-menu {\n\t\t/*display: flex;\n\t\tflex-direction: column;*/\n\t}\n\n\t@media (min-aspect-ratio: 1/1) {\n\t\t.d3c-1633357633-menu, .d3c-1633357633-body-overlay {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\t@media not all and (min-aspect-ratio: 1/1) {\n\t\t.d3c-1633357633-sidebar-minimized {\n\t\t\tdisplay: none;\n\t\t}\n\t\t.d3c-1633357633-sidebar {\n\t\t\tposition: absolute;\n\t\t}\n\t}\n\n\t.d3c-1633357633-sidebar-entries {\n\t\toverflow-y: scroll;\n\t}\n\n\t.d3c-1633357633-sidebar-entries > * {\n\t\twidth: 100%;\n\t}\n\n\t.d3c-1633357633-bottom-entries > * {\n\t\twidth: 100%;\n\t}\n\n\t.d3c-1633357633-spacer {\n\t\tflex-grow: 1;\n\t}\n\n\t.d3c-1633357633-body {\n\t\toverflow: auto;\n\t\tflex-grow: 1;\n\t\tflex-shrink: 1;\n\t}\n\n\t.d3c-1633357633-body-overlay {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tposition: fixed;\n\t\t/*backdrop-filter: blur(1px);*/\n\t}\n", Attr: []vugu.VGAttribute(nil)})
|
||||||
}
|
}
|
||||||
vgout.AppendCSS(vgn)
|
vgout.AppendCSS(vgn)
|
||||||
return vgout
|
return vgout
|
||||||
|
Loading…
Reference in New Issue
Block a user