enrecipes/app/components/modal/ActionDialog.vue

69 lines
1.7 KiB
Vue
Raw Normal View History

2020-10-21 17:54:45 +00:00
<template>
<Page>
<StackLayout class="dialogContainer" :class="appTheme">
2020-10-21 17:54:45 +00:00
<Label class="dialogTitle orkm" :text="title" />
2020-11-28 19:21:57 +00:00
<ScrollView width="100%" :height="height ? height : screenHeight - 256">
2020-11-10 18:28:48 +00:00
<StackLayout>
<MDButton
v-for="(item, index) in list"
:key="index"
class="actionItem"
variant="text"
:rippleColor="rippleColor"
:text="item"
@loaded="onLabelLoaded"
@tap="tapAction(item)"
/>
</StackLayout>
</ScrollView>
2020-11-02 11:36:53 +00:00
<GridLayout rows="auto" columns="auto, *, auto" class="actionsContainer">
2020-11-10 18:28:48 +00:00
<MDButton
:rippleColor="rippleColor"
variant="text"
2020-10-21 17:54:45 +00:00
v-if="action"
col="0"
2020-11-02 11:36:53 +00:00
class="action orkm pull-left"
2020-10-21 17:54:45 +00:00
:text="action"
@tap="$modal.close(action)"
/>
2020-11-10 18:28:48 +00:00
<MDButton
:rippleColor="rippleColor"
variant="text"
2020-10-21 17:54:45 +00:00
col="2"
2020-11-02 11:36:53 +00:00
class="action orkm pull-right"
2020-10-21 17:54:45 +00:00
text="CANCEL"
@tap="$modal.close(false)"
/>
</GridLayout>
</StackLayout>
</Page>
</template>
<script>
2020-11-10 18:28:48 +00:00
import { Application, Screen } from "@nativescript/core"
2020-10-21 17:54:45 +00:00
export default {
props: ["title", "list", "height", "action"],
computed: {
appTheme() {
return Application.systemAppearance()
},
2020-11-10 18:28:48 +00:00
rippleColor() {
return this.appTheme == "light"
? "rgba(134,142,150,0.2)"
: "rgba(206,212,218,0.1)"
},
screenHeight() {
return Math.round(Screen.mainScreen.heightDIPs)
},
2020-10-22 18:36:50 +00:00
},
2020-10-21 17:54:45 +00:00
methods: {
2020-11-10 18:28:48 +00:00
tapAction(item) {
2020-10-21 17:54:45 +00:00
this.$modal.close(item)
},
2020-11-10 18:28:48 +00:00
onLabelLoaded(args) {
args.object.android.setGravity(16)
},
2020-10-21 17:54:45 +00:00
},
}
</script>