2021-06-20 23:29:55 -05:00
|
|
|
<template>
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
<span class="container" :class="{ confirming }">
|
|
|
|
<span v-if="confirming">Are you sure?</span>
|
|
|
|
<button @click.stop="click" class="button danger" :disabled="disabled">
|
|
|
|
<span v-if="confirming">Yes</span>
|
|
|
|
<slot v-else />
|
|
|
|
</button>
|
|
|
|
<button v-if="confirming" class="button" @click.stop="cancel">No</button>
|
|
|
|
</span>
|
2021-06-20 23:29:55 -05:00
|
|
|
</template>
|
|
|
|
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
<script lang="ts">
|
|
|
|
import { defineComponent } from "vue";
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: "danger-button",
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
confirming: false
|
|
|
|
};
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
disabled: Boolean,
|
|
|
|
skipConfirm: Boolean
|
|
|
|
},
|
|
|
|
emits: ["click", "confirmingChanged"],
|
|
|
|
watch: {
|
|
|
|
confirming(newValue) {
|
|
|
|
this.$emit("confirmingChanged", newValue);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
click() {
|
|
|
|
if (this.skipConfirm) {
|
|
|
|
this.$emit("click");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (this.confirming) {
|
|
|
|
this.$emit("click");
|
|
|
|
}
|
|
|
|
this.confirming = !this.confirming;
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
this.confirming = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2021-06-20 23:29:55 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.container {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
display: flex;
|
2021-06-20 23:29:55 -05:00
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
2021-07-24 17:08:52 -05:00
|
|
|
.container.confirming button {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
font-size: 1em;
|
2021-07-24 17:08:52 -05:00
|
|
|
}
|
|
|
|
|
2021-06-20 23:29:55 -05:00
|
|
|
.container > * {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
margin: 0 4px;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
2021-07-02 08:48:34 -05:00
|
|
|
</style>
|
2021-06-20 23:29:55 -05:00
|
|
|
|
2021-07-02 08:48:34 -05:00
|
|
|
<style>
|
2021-06-20 23:29:55 -05:00
|
|
|
.danger {
|
2021-07-02 08:48:34 -05:00
|
|
|
position: relative;
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
border: solid 2px var(--danger);
|
2021-07-02 08:48:34 -05:00
|
|
|
border-right-width: 16px;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.danger::after {
|
2021-07-02 08:48:34 -05:00
|
|
|
position: absolute;
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
content: "!";
|
|
|
|
color: white;
|
2021-07-02 08:48:34 -05:00
|
|
|
right: -13px;
|
2021-06-20 23:29:55 -05:00
|
|
|
}
|
|
|
|
</style>
|