elk/components/publish/PublishWidget.vue

34 lines
752 B
Vue
Raw Normal View History

2022-11-16 22:27:02 +01:00
<script setup lang="ts">
2022-11-17 14:09:54 +01:00
const masto = await useMasto()
2022-11-16 22:27:02 +01:00
2022-11-17 14:09:54 +01:00
let draftPost = $ref('')
let isSending = $ref(false)
async function publish() {
try {
isSending = true
await masto.statuses.create({ status: draftPost })
draftPost = ''
}
finally {
isSending = false
}
}
2022-11-16 22:27:02 +01:00
</script>
<template>
<div xl:w-70 flex flex-col gap-4 :class="isSending ? ' pointer-events-none' : ''">
2022-11-20 22:21:53 +01:00
<textarea
v-model="draftPost"
placeholder="What's on your mind?"
p2 border-rounded w-full h-40
bg-gray:10 outline-none border="~ border"
/>
2022-11-16 22:27:02 +01:00
<div flex justify-end>
2022-11-17 14:09:54 +01:00
<button h-9 w-22 bg-primary border-rounded :disabled="draftPost === ''" @click="publish">
2022-11-16 22:27:02 +01:00
Publish!
</button>
</div>
</div>
</template>