| 1 |
<script lang="ts"> |
| 2 |
import { _ } from "../i18n"; |
| 3 |
import { keyboardShortcut } from "../keyboard-shortcuts"; |
| 4 |
|
| 5 |
interface Props { |
| 6 |
/** Whether anything is changed - the button is disabled otherwise. */ |
| 7 |
changed: boolean; |
| 8 |
/** Whether the contents are currently being saved. */ |
| 9 |
saving: boolean; |
| 10 |
} |
| 11 |
|
| 12 |
let { changed, saving }: Props = $props(); |
| 13 |
|
| 14 |
let buttonContent = $derived(saving ? _("Saving...") : _("Save")); |
| 15 |
</script> |
| 16 |
|
| 17 |
<button |
| 18 |
type="submit" |
| 19 |
disabled={!changed} |
| 20 |
use:keyboardShortcut={{ key: "Control+s", mac: "Meta+s" }} |
| 21 |
> |
| 22 |
{buttonContent} |
| 23 |
</button> |