Skip to content

Commit

Permalink
feat(snippets): add new snippet action
Browse files Browse the repository at this point in the history
  • Loading branch information
antonreshetov committed Mar 29, 2022
1 parent da12895 commit 60f35d7
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/renderer/components/snippets/SnippetListActionBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@
<div class="action">
<UniconsSearch />
<input placeholder="Search...">
<AppActionButton class="add">
<AppActionButton
class="add"
@click="onAddNewSnippet"
>
<UniconsPlus />
</AppActionButton>
</div>
</template>

<script setup lang="ts"></script>
<script setup lang="ts">
import { emitter } from '@/composable'
import { useFolderStore } from '@/store/folders'
import { useSnippetStore } from '@/store/snippets'
const snippetStore = useSnippetStore()
const folderStore = useFolderStore()
const onAddNewSnippet = async () => {
await snippetStore.addNewSnippet()
await snippetStore.getSnippetsByFolderIds(folderStore.selectedIds)
emitter.emit('focus:snippet-name', true)
}
</script>

<style lang="scss" scoped>
.action {
Expand Down

0 comments on commit 60f35d7

Please sign in to comment.