rename: Change 'origin' to 'alignment'
This commit is contained in:
1 parent
eb006ed982
commit
6eeada8c58
4 files changed
+13
-8
No files matched your search
@@ -66,7 +66,7 @@
|
|||||||
<Icon slot="icon" src={ChatBubbleOvalLeft} mini width={16} height={16} />
|
<Icon slot="icon" src={ChatBubbleOvalLeft} mini width={16} height={16} />
|
||||||
<FormattedNumber number={post.counts.comments} />
|
<FormattedNumber number={post.counts.comments} />
|
||||||
</Link>
|
</Link>
|
||||||
<Menu origin="top-right" class="ml-auto overflow-auto" let:toggleOpen>
|
<Menu alignment="bottom-right" class="ml-auto overflow-auto" let:toggleOpen>
|
||||||
<Button slot="button" label="Post actions" on:click={toggleOpen}>
|
<Button slot="button" label="Post actions" on:click={toggleOpen}>
|
||||||
<Icon src={EllipsisHorizontal} width={16} mini />
|
<Icon src={EllipsisHorizontal} width={16} mini />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -59,7 +59,12 @@
|
|||||||
<span class="text-xs">Reply</span>
|
<span class="text-xs">Reply</span>
|
||||||
</button>
|
</button>
|
||||||
<div class="h-full relative">
|
<div class="h-full relative">
|
||||||
<Menu let:toggleOpen class="h-[26px] top-0" absolute origin="bottom-center">
|
<Menu
|
||||||
|
let:toggleOpen
|
||||||
|
class="h-[26px] top-0"
|
||||||
|
absolute
|
||||||
|
alignment="bottom-center"
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
slot="button"
|
slot="button"
|
||||||
class="{Color.borderDark} h-full px-1 flex flex-row items-center gap-1
|
class="{Color.borderDark} h-full px-1 flex flex-row items-center gap-1
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<Icon src={GlobeAlt} width={16} />
|
<Icon src={GlobeAlt} width={16} />
|
||||||
<span class="hidden sm:inline ml-1">Explore</span>
|
<span class="hidden sm:inline ml-1">Explore</span>
|
||||||
</Link>
|
</Link>
|
||||||
<Menu let:toggleOpen origin="bottom-right">
|
<Menu let:toggleOpen alignment="bottom-right">
|
||||||
<Button
|
<Button
|
||||||
color={Color.accent}
|
color={Color.accent}
|
||||||
slot="button"
|
slot="button"
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
</MenuButton>
|
</MenuButton>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
<Menu let:toggleOpen origin="bottom-right">
|
<Menu let:toggleOpen alignment="bottom-right">
|
||||||
<button
|
<button
|
||||||
class="w-8 h-8 rounded-full ring-1 ring-slate-300 bg-slate-100
|
class="w-8 h-8 rounded-full ring-1 ring-slate-300 bg-slate-100
|
||||||
dark:bg-zinc-800 relative"
|
dark:bg-zinc-800 relative"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
export let absolute = false
|
export let absolute = false
|
||||||
|
|
||||||
type Origin =
|
type Alignment =
|
||||||
| 'top-right'
|
| 'top-right'
|
||||||
| 'top-left'
|
| 'top-left'
|
||||||
| 'bottom-right'
|
| 'bottom-right'
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
| 'bottom-center'
|
| 'bottom-center'
|
||||||
| 'top-center'
|
| 'top-center'
|
||||||
|
|
||||||
export let origin: Origin = 'bottom-left'
|
export let alignment: Alignment = 'bottom-left'
|
||||||
|
|
||||||
let element: any
|
let element: any
|
||||||
|
|
||||||
export const toggleOpen = () => (open = !open)
|
export const toggleOpen = () => (open = !open)
|
||||||
|
|
||||||
function getOriginClass(origin: Origin) {
|
function getOriginClass(origin: Alignment) {
|
||||||
switch (origin) {
|
switch (origin) {
|
||||||
case 'top-right':
|
case 'top-right':
|
||||||
return 'bottom-[100%] right-0 origin-bottom-right'
|
return 'bottom-[100%] right-0 origin-bottom-right'
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
easing: expoOut,
|
easing: expoOut,
|
||||||
}}
|
}}
|
||||||
class="list-none absolute max-h-72 z-30 overflow-auto {getOriginClass(
|
class="list-none absolute max-h-72 z-30 overflow-auto {getOriginClass(
|
||||||
origin
|
alignment
|
||||||
)}
|
)}
|
||||||
rounded-md py-2 min-w-[16rem] my-2 flex flex-col shadow-md
|
rounded-md py-2 min-w-[16rem] my-2 flex flex-col shadow-md
|
||||||
bg-white dark:bg-zinc-900 border border-slate-200 dark:border-zinc-800
|
bg-white dark:bg-zinc-900 border border-slate-200 dark:border-zinc-800
|
||||||
|
|||||||
Reference in new issue
Block a user