Skip to content

Commit

Permalink
Refactor the rest of MarkdownSelector to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Feb 10, 2024
1 parent 7de9b83 commit e66aff4
Showing 1 changed file with 39 additions and 49 deletions.
88 changes: 39 additions & 49 deletions client/src/components/Markdown/MarkdownSelector.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
<script setup lang="ts">
import BootstrapVue from "bootstrap-vue";
import Vue, { computed, ref } from "vue";
import LabelSelector from "./LabelSelector.vue";
interface MarkdownSelectorProps {
labelTitle?: string;
labels: string[];
argumentName?: string;
}
const props = defineProps<MarkdownSelectorProps>();
const selectedValue = ref<string | undefined>(undefined);
const modalShow = ref(true);
const title = computed(() => {
return `Insert '${props.argumentName}'`;
});
const hasLabels = computed(() => {
return props.labels && props.labels.length > 0;
});
const emit = defineEmits<{
(e: "onOk", value: string | undefined): void;
(e: "onCancel"): void;
}>();
Vue.use(BootstrapVue);
function onOk() {
emit("onOk", selectedValue.value);
}
function onCancel() {
emit("onCancel");
}
</script>

<template>
<span>
<b-modal
Expand All @@ -16,52 +55,3 @@
</b-modal>
</span>
</template>

<script>
import BootstrapVue from "bootstrap-vue";
import Vue from "vue";
import LabelSelector from "./LabelSelector";
Vue.use(BootstrapVue);
export default {
components: { LabelSelector },
props: {
labelTitle: {
type: String,
default: "",
},
labels: {
type: Array,
default: null,
},
argumentName: {
type: String,
default: null,
},
},
data() {
return {
selectedValue: undefined,
modalShow: true,
};
},
computed: {
title() {
return `Insert '${this.argumentName}'`;
},
hasLabels() {
return this.labels && this.labels.length > 0;
},
},
methods: {
onOk() {
this.$emit("onOk", this.selectedValue);
},
onCancel() {
this.$emit("onCancel");
},
},
};
</script>

0 comments on commit e66aff4

Please sign in to comment.