logigate/app/components/editor/Rail.vue

28 lines
913 B
Vue

<script setup lang="ts">
// The side panel, hidden, shrinks to this strip; its buttons bring it back.
const ed = useEditor()
const TABS = [
{ id: 'selection', label: 'Selection', icon: 'lucide:mouse-pointer-2' },
{ id: 'circuit', label: 'Circuit', icon: 'lucide:cpu' },
{ id: 'pins', label: 'Pins', icon: 'lucide:list' },
{ id: 'test', label: 'Test', icon: 'lucide:table' },
] as const
function openTab(id: (typeof TABS)[number]['id']) {
ed.rightTab.value = id
ed.toggleSidebar('right', true)
}
</script>
<template>
<aside class="rail">
<button class="rail-btn" title="Show the side panel ([)" @click="ed.toggleSidebar('right', true)">
<Icon name="lucide:panel-left-open" class="size-4" />
</button>
<button v-for="t in TABS" :key="t.id" class="rail-btn" :title="t.label" @click="openTab(t.id)">
<Icon :name="t.icon" class="size-4" />
</button>
</aside>
</template>