enrecipes/app/components/modal/ConfirmDialog.vue
2021-03-10 21:29:50 +05:30

76 lines
1.8 KiB
Vue

<template>
<Page @loaded="onPageLoad" backgroundColor="transparent">
<StackLayout class="dialogContainer" :class="appTheme">
<Label
class="er dialogIcon"
:backgroundColor="bgColor"
:color="iconColor"
:text="icon[helpIcon]"
/>
<Label class="dialogTitle orkm" :text="`${title}` | L" textWrap="true" />
<Label
v-if="description"
class="dialogDescription"
:text="description"
textWrap="true"
/>
<GridLayout rows="auto" columns="*, auto, auto" class="actionsContainer">
<MDButton
v-if="cancelButtonText"
variant="text"
col="1"
class="action orkm"
:text="`${cancelButtonText}` | L"
@tap="$modal.close(false)"
/>
<MDButton
variant="text"
col="2"
class="action orkm"
:text="`${okButtonText}` | L"
@tap="$modal.close(true)"
/>
</GridLayout>
</StackLayout>
</Page>
</template>
<script>
import { Application, Color } from "@nativescript/core";
import { mapState } from "vuex";
export default {
props: [
"title",
"description",
"cancelButtonText",
"okButtonText",
"helpIcon",
"bgColor",
],
computed: {
...mapState(["icon"]),
appTheme() {
return Application.systemAppearance();
},
isLightMode() {
return this.appTheme == "light";
},
iconColor() {
return this.isLightMode ? "#f0f0f0" : "#1A1A1A";
},
},
methods: {
onPageLoad(args) {
args.object._dialogFragment
.getDialog()
.getWindow()
.setBackgroundDrawable(
new android.graphics.drawable.ColorDrawable(
android.graphics.Color.TRANSPARENT
)
);
},
},
};
</script>