This repository has been archived by the owner on Aug 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added context menu and context button components
- Loading branch information
1 parent
b78ce9f
commit 1aaf128
Showing
9 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<script> | ||
import FdButton from "./../Button/Button.vue"; | ||
export default { | ||
name: "FdContextButton", | ||
extends: FdButton, | ||
props: { | ||
styling: { | ||
default: "light" | ||
}, | ||
icon: { | ||
default: "overflow" | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import ContextButton from "./ContextButton.vue"; | ||
import { pluginify } from "./../../util"; | ||
export default pluginify(ContextButton); | ||
export { ContextButton }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<template> | ||
<fd-menu-popover placement="bottom-start" with-arrow :flips="false"> | ||
<template #control="popoverProps"> | ||
<slot name="button" v-bind="controlProps(popoverProps)"> | ||
<fd-context-button @click="popoverProps.toggle" /> | ||
</slot> | ||
</template> | ||
<template #default> | ||
<slot /> | ||
</template> | ||
</fd-menu-popover> | ||
</template> | ||
|
||
<script> | ||
import FdMenuPopover from "./../MenuPopover/MenuPopover.vue"; | ||
import FdContextButton from "./../ContextButton/ContextButton.vue"; | ||
export default { | ||
name: "FdContextMenu", | ||
components: { FdMenuPopover, FdContextButton }, | ||
methods: { | ||
controlProps(controlProps) { | ||
return { | ||
...controlProps, | ||
toggleContextMenu: controlProps.toggle | ||
}; | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import ContextMenu from "./ContextMenu.vue"; | ||
import { pluginify } from "./../../util"; | ||
export default pluginify(ContextMenu); | ||
export { ContextMenu }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<title>Default Context Menu</title> | ||
|
||
<template> | ||
<fd-context-menu> | ||
<fd-menu-list> | ||
<fd-menu-item>New File</fd-menu-item> | ||
<fd-menu-item>New Window</fd-menu-item> | ||
<fd-menu-item>About Fundamental Vue</fd-menu-item> | ||
<fd-menu-item>Check for Updates…</fd-menu-item> | ||
</fd-menu-list> | ||
</fd-context-menu> | ||
</template> |
24 changes: 24 additions & 0 deletions
24
src/docs/pages/Context Menu/1-context-menu-custom-button.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<title>Context Menu with custom Button</title> | ||
|
||
<docs> | ||
Use the `button`-slot in order to provide a custom `fd-context-button`. | ||
</docs> | ||
|
||
<template> | ||
<fd-context-menu> | ||
<template #button="{toggleContextMenu}"> | ||
<fd-context-button | ||
styling="emphasized" | ||
:icon="null" | ||
@click="toggleContextMenu" | ||
>More…</fd-context-button | ||
> | ||
</template> | ||
<fd-menu-list> | ||
<fd-menu-item>New File</fd-menu-item> | ||
<fd-menu-item>New Window</fd-menu-item> | ||
<fd-menu-item>About Fundamental Vue</fd-menu-item> | ||
<fd-menu-item>Check for Updates…</fd-menu-item> | ||
</fd-menu-list> | ||
</fd-context-menu> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters