-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add onclickoutside prop to Menu
- Loading branch information
Showing
9 changed files
with
68 additions
and
59 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,23 @@ | ||
<script context="module" lang="ts"> | ||
import type { Viewport } from 'kitbook' | ||
|
||
const null_defaults_to_full_width = null | ||
export const viewports: Viewport[] = [ | ||
{ width: null_defaults_to_full_width, height: 250 }, | ||
] | ||
</script> | ||
|
||
<script lang="ts"> | ||
import Menu from './Menu.svelte' | ||
</script> | ||
|
||
<Menu onclickoutside={() => alert('clicked outside')}> | ||
<div class="px-4 py-2 text-xs font-semibold text-gray-600">John Smith</div> | ||
<div class="px-4 py-2 -mt-3 text-xs text-gray-600 border-b">j@jim.com</div> | ||
<a href="/admin"> | ||
Admin Panel | ||
<span class="i-fa-solid-key" /> | ||
</a> | ||
<a href="/account"> Settings </a> | ||
<button> Log out </button> | ||
</Menu> |
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 |
---|---|---|
@@ -1,39 +1 @@ | ||
<script> | ||
import { Story } from 'kitbook'; | ||
import Menu from '$lib/shell/Menu.svelte'; | ||
import { portal } from '$lib/actions/portal'; | ||
|
||
</script> | ||
|
||
<Story> | ||
<div class="relative bg-white p-3 w-full" style="height: 250px;"> | ||
<Menu> | ||
<div class="px-4 py-2 text-xs font-semibold text-gray-600">John Smith</div> | ||
<div class="px-4 py-2 -mt-3 text-xs text-gray-600 border-b">j@jim.com</div> | ||
<a href="/admin"> | ||
Admin Panel | ||
<span class="i-fa-solid-key" /> | ||
</a> | ||
<a href="/account"> Settings </a> | ||
<button> Log out </button> | ||
</Menu> | ||
</div> | ||
</Story> | ||
|
||
<Story name="portaled to body"> | ||
<div class="relative bg-white p-3 w-full" style="height: 250px;"> | ||
<!-- <Menu class="ltr:right-2 rtl:left-2 top-11" /> --> | ||
<Menu {portal}> | ||
<div class="px-4 py-2 text-xs font-semibold text-gray-600">John Smith</div> | ||
<div class="px-4 py-2 -mt-3 text-xs text-gray-600 border-b">j@jim.com</div> | ||
<a href="/admin"> | ||
Admin Panel | ||
<span class="i-fa-solid-key" /> | ||
</a> | ||
<a href="/account"> Settings </a> | ||
<button> Log out </button> | ||
</Menu> | ||
</div> | ||
</Story> | ||
|
||
Use `use:portal` if needed to solve z-index issues. | ||
Add a `portalTarget` if needed to solve z-index issues. |
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 lang="ts"> | ||
import Menu from './Menu.svelte' | ||
</script> | ||
|
||
<div class="relative bg-white p-3 w-full" style="height: 250px;"> | ||
<Menu portalTarget="body"> | ||
<div class="px-4 py-2 text-xs font-semibold text-gray-600">John Smith</div> | ||
<div class="px-4 py-2 -mt-3 text-xs text-gray-600 border-b">j@jim.com</div> | ||
<a href="/admin"> | ||
Admin Panel | ||
<span class="i-fa-solid-key" /> | ||
</a> | ||
<a href="/account"> Settings </a> | ||
<button> Log out </button> | ||
</Menu> | ||
</div> |
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