Files
Graphite/frontend/src/components/window/status-bar/StatusBar.svelte
T
Keavon Chambers 810ce40e9b Restyle and refactor shortcut labels to send hints bar and welcome screen layouts from Rust (#3447)
* Restyle UserInputLabel and refactor its usages to have all input its data sent from Rust

* Replace the welcome screen quick buttons with ones sent by backend

* Add the ShortcutLabel widget to the backend

* Replace hints bar with a backend-controlled layout; show mouse icons in place of mouse labels
2025-12-04 01:04:14 -08:00

59 lines
1.3 KiB
Svelte

<script lang="ts">
import { getContext, onMount } from "svelte";
import type { Editor } from "@graphite/editor";
import { defaultWidgetLayout, patchWidgetLayout, UpdateStatusBarHintsLayout } from "@graphite/messages";
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
import WidgetLayout from "@graphite/components/widgets/WidgetLayout.svelte";
const editor = getContext<Editor>("editor");
let statusBarHintsLayout = defaultWidgetLayout();
onMount(() => {
editor.subscriptions.subscribeJsMessage(UpdateStatusBarHintsLayout, (updateStatusBarHintsLayout) => {
patchWidgetLayout(statusBarHintsLayout, updateStatusBarHintsLayout);
statusBarHintsLayout = statusBarHintsLayout;
});
});
</script>
<LayoutRow class="status-bar">
<WidgetLayout class="hints" layout={statusBarHintsLayout} />
</LayoutRow>
<style lang="scss" global>
.status-bar {
height: 24px;
width: 100%;
flex: 0 0 auto;
.hints {
overflow: hidden;
--row-height: 24px;
margin: 0 4px;
max-width: calc(100% - 2 * 4px);
.text-label,
.shortcut-label {
align-items: center;
flex-shrink: 0;
+ .text-label,
+ .shortcut-label {
margin-left: 4px;
}
}
.text-label:not(.bold) + .shortcut-label {
margin-left: 12px;
}
.text-label.bold {
padding: 0 4px;
}
}
}
</style>