Files
Graphite/frontend/src/components/widgets/buttons/PopoverButton.vue
mfish33 a0c22d20b6 Welcome screen, refactor to allow zero documents, and add TS typing to widgets (#702)
* unfinished implementation

* Add frontend for the empty panel screen

* Add an icon for Folder based on NodeFolder

* fixed messages causing peicees of ui not to render on new document

* Standardize nextTick syntax

* WIP generisization of component subscriptions (not compiling yet)

* Fix crash when loading font and there is no active document

* Only advertise tool actions with a document

* Fix failure to create new document

* Initalise the properties panel

* Fix highlight tab, canvas jump, warns and layer tree

* Fix tests

* Possibly fix some things?

* Move WorkingColors layout definition to backend

* Standardize action macro formatting

* Provide typing for widgets in TS/Vue and associated cleanup

* Fix viewport positioning initialization

* Fix menu bar init at startup not document creation

* Fix no viewport bounds bug

* Change !=0 to >0

* Simplify the init system

Closes #656

Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: 0hypercube <0hypercube@gmail.com>
2022-07-22 16:09:13 -06:00

84 lines
1.7 KiB
Vue

<template>
<LayoutRow class="popover-button">
<IconButton :action="() => onClick()" :icon="icon" :size="16" data-hover-menu-spawner />
<FloatingMenu v-model:open="open" :type="'Popover'" :direction="'Bottom'">
<slot></slot>
</FloatingMenu>
</LayoutRow>
</template>
<style lang="scss">
.popover-button {
position: relative;
width: 16px;
height: 24px;
flex: 0 0 auto;
.floating-menu {
left: 50%;
bottom: 0;
}
.icon-button {
width: 100%;
height: 100%;
padding: 0;
outline: none;
border: none;
border-radius: 2px;
background: var(--color-1-nearblack);
fill: var(--color-e-nearwhite);
&:hover {
background: var(--color-6-lowergray);
fill: var(--color-f-white);
}
}
// TODO: Refactor this and other complicated cases dealing with joined widget margins and border-radius by adding a single standard set of classes: joined-first, joined-inner, and joined-last
div[class*="-input"] + & {
margin-left: 1px;
.icon-button {
border-radius: 0 2px 2px 0;
}
}
}
</style>
<script lang="ts">
import { defineComponent, PropType } from "vue";
import { IconName } from "@/utility-functions/icons";
import FloatingMenu from "@/components/floating-menus/FloatingMenu.vue";
import LayoutRow from "@/components/layout/LayoutRow.vue";
import IconButton from "@/components/widgets/buttons/IconButton.vue";
export default defineComponent({
components: {
FloatingMenu,
IconButton,
LayoutRow,
},
props: {
icon: { type: String as PropType<IconName>, default: "DropdownArrow" },
// Callbacks
action: { type: Function as PropType<() => void>, required: false },
},
data() {
return {
open: false,
};
},
methods: {
onClick() {
this.open = true;
this.action?.();
},
},
});
</script>