-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add action buttons for each tab
- Loading branch information
1 parent
f12d3cf
commit af71754
Showing
4 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<template> | ||
<div class="mx-10 my-8 flex items-center justify-between"> | ||
<div class="flex h-8 items-center text-xl font-semibold text-gray-800"> | ||
{{ title }} | ||
</div> | ||
<Button | ||
v-if="title == 'Emails'" | ||
variant="solid" | ||
@click="communicationAreaRef.toggleEmailBox()" | ||
> | ||
<template #prefix> | ||
<FeatherIcon name="plus" class="h-4 w-4" /> | ||
</template> | ||
<span>{{ "New Email" }}</span> | ||
</Button> | ||
<Button | ||
v-else-if="title == 'Comments'" | ||
variant="solid" | ||
@click="communicationAreaRef.toggleCommentBox()" | ||
> | ||
<template #prefix> | ||
<FeatherIcon name="plus" class="h-4 w-4" /> | ||
</template> | ||
<span>{{ "New Comment" }}</span> | ||
</Button> | ||
<Dropdown v-else :options="defaultActions" @click.stop> | ||
<template v-slot="{ open }"> | ||
<Button variant="solid" class="flex items-center gap-1"> | ||
<template #prefix> | ||
<FeatherIcon name="plus" class="h-4 w-4" /> | ||
</template> | ||
<span>{{ "New" }}</span> | ||
<template #suffix> | ||
<FeatherIcon | ||
:name="open ? 'chevron-up' : 'chevron-down'" | ||
class="h-4 w-4" | ||
/> | ||
</template> | ||
</Button> | ||
</template> | ||
</Dropdown> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { h } from "vue"; | ||
import { computed } from "vue"; | ||
import { EmailIcon, CommentIcon } from "@/components/icons"; | ||
import { Dropdown } from "frappe-ui"; | ||
import { inject } from "vue"; | ||
import { Ref } from "vue"; | ||
defineProps({ | ||
title: { | ||
type: String, | ||
required: true, | ||
}, | ||
}); | ||
const communicationAreaRef: Ref = inject("communicationArea"); | ||
const defaultActions = computed(() => { | ||
let actions = [ | ||
{ | ||
icon: h(EmailIcon, { class: "h-4 w-4" }), | ||
label: "New Email", | ||
onClick: () => communicationAreaRef.value.toggleEmailBox(), | ||
}, | ||
{ | ||
icon: h(CommentIcon, { class: "h-4 w-4" }), | ||
label: "New Comment", | ||
onClick: () => communicationAreaRef.value.toggleCommentBox(), | ||
}, | ||
]; | ||
return actions; | ||
}); | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters