Skip to content

Commit 4f0df6c

Browse files
committed
WIP: impl TextSelectionmenu by floating-ui
add menu item buttons TODO: - document - menu impl - delay to show
1 parent d798891 commit 4f0df6c

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

src/components/TextSelectionMenu.vue

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,51 @@ const target = computed((): VirtualElement | undefined => {
4141
</script>
4242

4343
<template>
44-
TODO: use target if specified instead of #default slot
4544
<Floating placement="top" interactive inline :target="target" :trigger="trigger">
4645
<template #content>
47-
ここにメニュー要素を配置
46+
<!-- TODO: メニュー要素はpropsで受け取る -->
47+
<div class="menu">
48+
<div class="menu-item">
49+
<button>This is</button>
50+
</div>
51+
<div class="menu-item">
52+
<button>Menu</button>
53+
</div>
54+
<div class="menu-item">
55+
<button>Buttons</button>
56+
</div>
57+
</div>
4858
</template>
4959
</Floating>
5060
</template>
61+
62+
<style scoped>
63+
.menu {
64+
display: flex;
65+
flex-wrap: nowrap;
66+
}
67+
68+
.menu-item {
69+
flex: 0 0 fit-content;
70+
z-index: 10003;
71+
72+
+.menu-item {
73+
border-left: 1px solid rgb(0 0 0 / .2);;
74+
}
75+
76+
button {
77+
padding: 4px 8px;
78+
background-color: white;
79+
border: 0;
80+
81+
&:hover {
82+
background-color: rgb(0 0 0 / .1);
83+
}
84+
85+
&:active {
86+
/*on press in, make the button look like it's being pushed*/
87+
transform: translate(0, 2px);
88+
}
89+
}
90+
}
91+
</style>

0 commit comments

Comments
 (0)