feature/tauri-v2
svelte 92 lines 2.48 KB
Raw
1 <script lang="ts">
2 import { hideBottomPanel } from "./Statusbar.svelte";
3 import Ellipsis from "carbon-icons-svelte/lib/OverflowMenuHorizontal.svelte";
4 import Menu from "./utility/Menu.svelte";
5
6 export let name = "Tool";
7 export let options = [];
8 export let buttons = [];
9 </script>
10 <div id="toolview">
11 <div class="header">{name}
12 <div class="header-tools">
13 {#if buttons}
14 <div class="tool-buttons">
15 {#each buttons as button}
16 <!-- svelte-ignore a11y-click-events-have-key-events -->
17 <div class="tool-button" title={button.title} on:click={button.action}>
18 <svelte:component this={button.icon}></svelte:component>
19 </div>
20 {/each}
21 </div>
22 {/if}
23 {#if options}
24 <Menu right menu={{icon: Ellipsis, children: options}}></Menu>
25 {/if}
26 <!-- svelte-ignore a11y-click-events-have-key-events -->
27 <span class="close" title="Hide Panel" on:click={hideBottomPanel}></span>
28 </div>
29 </div>
30 <div id="toolview-container"></div>
31 </div>
32
33 <style lang="scss">
34 #toolview {
35 height: calc(100% - 37px);
36 width: 100%;
37 }
38 #toolview-container {
39 padding: 8px;
40 height: 100%;
41 }
42 .header {
43 height: 35px;
44 display: flex;
45 flex-direction: row;
46 align-items: center;
47 justify-content: space-between;
48 padding: 0 8px;
49 .header-tools {
50 display: flex;
51 justify-content: center;
52 align-items: center;
53 gap: 5px;
54 flex-direction: row;
55 .tool-buttons {
56 height: 24px;
57 display: flex;
58 flex-direction: row;
59 align-items: center;
60 justify-content: center;
61 }
62 .tool-button {
63 display: flex;
64 align-items: center;
65 justify-content: center;
66 height: 100%;
67 cursor: pointer;
68 }
69 :global(.menu-button), .tool-button {
70 min-width: unset;
71 padding: 0 7px;
72 border-radius: 3px;
73 }
74 :global(.tool-button svg) {
75 width: 18px;
76 height: 18px;
77 }
78 }
79 .close {
80 font-size: 12px;
81 padding: 0 7px;
82 display: flex;
83 align-items: center;
84 justify-content: center;
85 border-radius: 3px;
86 cursor: pointer;
87 &::before {
88 content: "\2715";
89 }
90 }
91 }
92 </style>