-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new Menu Component #2933
Add new Menu Component #2933
Changes from 1 commit
7b79502
0cae35b
808da47
47b5a80
e0ac01d
10df911
0764ef5
c874f58
aac98a3
6805f01
00fb04d
dc218ec
07c6a9b
6909f62
5bf9447
d916f48
756cbb8
fa24ff5
c5000c7
7532e3d
f2d8d8b
cec22b2
147430b
dde9a32
1e7700c
f7e976d
658e17c
2614ce3
89b2537
7299273
f9ce524
5ca32c5
43c0ed9
2d2bfe0
093d392
ba5365c
689b54f
c4e9962
192b42d
8c0217c
a829f0f
0c5ca11
8471451
5f38ae0
fc2345a
2ac4396
a075c64
7c7069e
a5431da
45a9fcf
5eb0da4
4d7fcbf
8328e37
2aefd66
c4cc3d5
ab84496
b6c66ff
905e029
458dc20
f08a949
2d008d9
1a010ad
cc2c841
6b5bc60
0617fa5
3a7bea6
c5dc4a5
ef9bdcc
b92d068
57ebf27
5e1ba95
b20e419
18c0447
6f45545
3dfaf20
6c7ca7a
65848d8
3b862a1
7ec3ce6
1df8948
09e3a13
ab36ce4
6a21291
14a208d
5be5de9
b48a5a3
be5b23e
944e686
006564a
ffdd66b
72a0fbe
e4326ab
0df3662
c7fe87d
18069dd
b95eb68
1d339f9
0c4ca12
9beadd4
e667430
e7e2ca4
f4ca3c9
db14dd7
acbe46d
147edd2
cf6229f
1e9e683
a6574bd
731c038
aa3d032
c58a8ec
e5ab2d4
1fe3fef
5ab0191
95a958c
2fdd2aa
898c008
ab6868a
8329654
fa80b34
b81f907
baa1b5f
f5bd2db
54d7ff3
8bf2aa4
2c78540
c499445
569fbfd
b9e3137
88b6731
fd721bc
d86512d
6a4acd2
baec3a5
925937a
becc610
5c3a30f
519913a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
const config = { | ||
selector: 'cookbook-menu-custom-placement-example', | ||
template: `<kirby-menu [placement]="'bottom-end'"> | ||
<kirby-item [selectable]="true"> | ||
<h3>Action 1</h3> | ||
</kirby-item> | ||
<kirby-item [selectable]="true"> | ||
<h3>Action 2</h3> | ||
</kirby-item> | ||
</kirby-menu>`, | ||
}; | ||
|
||
@Component({ | ||
selector: config.selector, | ||
template: config.template, | ||
}) | ||
export class MenuCustomPlacementExampleComponent { | ||
template: string = config.template; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
const config = { | ||
selector: 'cookbook-menu-hover-trigger-example', | ||
template: `<kirby-menu [triggers]="['hover']"> | ||
<kirby-item [selectable]="true"> | ||
<h3>Action 1</h3> | ||
</kirby-item> | ||
<kirby-item [selectable]="true"> | ||
<h3>Action 2</h3> | ||
</kirby-item> | ||
</kirby-menu>`, | ||
}; | ||
|
||
@Component({ | ||
selector: config.selector, | ||
template: config.template, | ||
}) | ||
export class MenuHoverTriggerExampleComponent { | ||
template: string = config.template; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,11 @@ <h3>Portal</h3> | |
. It is your task to provide a reference to the DOM element for which you want to portal the | ||
menu content into. This can example be achieved by using: | ||
<code>document.getElementsByTagName(outletTag)[0] as HTMLElement</code> | ||
. Here outlet tag references a known tag in the DOM, for which there should only exists one. | ||
This could for example be one of the top elements in the DOM. This is not generalized, since | ||
each project may have different tags for which they want the content to be placed under. This | ||
approach is also to prevent the need for adjusting the DOM with an extra base element, when the | ||
need for portal arises. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Her er et bud på en anden formulering: In some cases, like when using the menu inside an item, you might experience that the menu doesn't show when clicked. This is due to the menu being placed in a "lower" part of the stacking context. To solve this, we need to move the menu further up, and we do this by using a "portal". |
||
</p> | ||
<strong> | ||
<em> | ||
|
@@ -70,6 +75,28 @@ <h2>Menu: Advanced item</h2> | |
</div> | ||
</div> | ||
|
||
<div class="page-example"> | ||
<div> | ||
<h2>Menu: Placement</h2> | ||
<cookbook-example-viewer [html]="menuPlacementExample.template"> | ||
<cookbook-menu-custom-placement-example | ||
#menuPlacementExample | ||
></cookbook-menu-custom-placement-example> | ||
</cookbook-example-viewer> | ||
</div> | ||
</div> | ||
|
||
<div class="page-example"> | ||
<div> | ||
<h2>Menu: Hover trigger</h2> | ||
<cookbook-example-viewer [html]="menuHoverTriggerExample.template"> | ||
<cookbook-menu-hover-trigger-example | ||
#menuHoverTriggerExample | ||
></cookbook-menu-hover-trigger-example> | ||
</cookbook-example-viewer> | ||
</div> | ||
</div> | ||
|
||
<div class="page-example"> | ||
<div> | ||
<h2>Menu: Custom button</h2> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"This can for example be achieved by using"