mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 14:16:01 +00:00
buttons folder
This commit is contained in:
23
packages/web/src/buttons/DropDownButton.svelte
Normal file
23
packages/web/src/buttons/DropDownButton.svelte
Normal file
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
import _ from 'lodash';
|
||||
|
||||
import FontIcon from '../icons/FontIcon.svelte';
|
||||
import { currentDropDownMenu } from '../stores';
|
||||
import InlineButton from './InlineButton.svelte';
|
||||
|
||||
export let icon = 'icon chevron-down';
|
||||
export let menu;
|
||||
export let narrow = false;
|
||||
let domButton;
|
||||
|
||||
function handleClick() {
|
||||
const rect = domButton.getBoundingClientRect();
|
||||
const left = rect.left;
|
||||
const top = rect.bottom;
|
||||
currentDropDownMenu.set({ left, top, items: menu });
|
||||
}
|
||||
</script>
|
||||
|
||||
<InlineButton square {narrow} on:click={handleClick} bind:this={domButton}>
|
||||
<FontIcon {icon} />
|
||||
</InlineButton>
|
||||
Reference in New Issue
Block a user