Skip to content

Commit

Permalink
components(calculator/share-dialog): major refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurg committed Apr 2, 2024
1 parent 804b938 commit 89ee81d
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 138 deletions.
3 changes: 2 additions & 1 deletion assets/scss/components/_index.scss
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@import "./dialog.scss";
// FIXME: Removing this causes SASS error.
@import "~vuetify/src/styles/styles.sass";
32 changes: 0 additions & 32 deletions assets/scss/components/dialog.scss

This file was deleted.

211 changes: 106 additions & 105 deletions components/calculator/share-dialog.vue
Original file line number Diff line number Diff line change
@@ -1,140 +1,141 @@
<template>
<v-dialog
:value="value"
:value="props.value"
:fullscreen="$vuetify.breakpoint.smAndDown"
:transition="transition"
content-class="vh-dialog"
:transition="$vuetify.breakpoint.smAndDown ? 'dialog-bottom-transition' : 'dialog-transition'"
overlay-color="#000"
overlay-opacity=".75"
width="700"
@click:outside="close()"
@close="close()">
<div class="vh-dialog__header">
<v-toolbar
class="px-2"
elevation="0">
<v-toolbar-title class="text-center">
Sonuçları paylaş
</v-toolbar-title>
<v-toolbar flat="">
<v-toolbar-title>
Sonuçları paylaş
</v-toolbar-title>

<v-spacer />
<v-spacer />

<v-btn
icon=""
@click="close()">
<v-icon>
{{ icons.mdiClose }}
</v-icon>
</v-btn>
</v-toolbar>
<v-btn
icon=""
@click="close()">
<v-icon>
{{ mdiClose }}
</v-icon>
</v-btn>

<v-tabs
v-model="currentTab"
:grow="$vuetify.breakpoint.mdAndDown"
:fixed-tabs="!$vuetify.breakpoint.mdAndDown"
class="vh-share-tabs"
background-color="transparent">
<v-tab>
<v-icon left="">
{{ icons.mdiLink }}
</v-icon>
<span>Bağlantı</span>
</v-tab>
<v-tab>
<v-icon left="">
{{ icons.mdiCellphoneScreenshot }}
</v-icon>
<span>Ekran Görüntüsü</span>
</v-tab>
</v-tabs>
</div>
<template #extension>
<v-tabs
v-model="currentTab"
fixed-tabs="">
<v-tab>
<v-icon left="">
{{ mdiLink }}
</v-icon>
<span>Bağlantı</span>
</v-tab>
<v-tab>
<v-icon left="">
{{ mdiCellphoneScreenshot }}
</v-icon>
<span>Ekran Görüntüsü</span>
</v-tab>
</v-tabs>
</template>
</v-toolbar>

<div class="vh-dialog__content">
<div class="body">
<template v-if="currentTab === 0">
<div class="d-flex flex-column h-100">
<div class="mt-auto py-10 px-6 py-lg-12 px-lg-8">
<lazy-calculator-share-dialog-url :form="form" />
</div>
<div class="mt-auto py-10 px-6 py-lg-12 px-lg-8">
<lazy-calculator-share-dialog-url :form="props.form" />
</div>
</template>
<template v-else-if="currentTab === 1">
<div class="d-flex flex-column h-100">
<div class="mt-auto py-10 py-lg-6 px-2">
<calculator-share-dialog-screenshot
:input="screenshotInput"
:output="screenshotOutput"
:calculator-title="calculatorTitle"
:preset-title="presetTitle"
:preset-option-title="presetOptionTitle" />
</div>
<div class="mt-auto py-10 py-lg-6 px-2">
<calculator-share-dialog-screenshot
:input="props.screenshotInput"
:output="props.screenshotOutput"
:calculator-title="props.calculatorTitle"
:preset-title="props.presetTitle"
:preset-option-title="props.presetOptionTitle" />
</div>
</template>
</div>
</v-dialog>
</template>

<script>
<script setup="">
import { mdiCellphoneScreenshot, mdiClose, mdiLink } from "@mdi/js";
import { ref } from "vue";
export default {
data: () => ({
icons: {
mdiClose,
mdiLink,
mdiCellphoneScreenshot
},
currentTab: 0
}),
props: {
value: {
type: Boolean
},
form: {
type: Object,
required: true
},
screenshotInput: {
type: Array,
default: () => ([])
},
screenshotOutput: {
type: Array,
required: true
},
calculatorTitle: {
type: String,
required: true
},
presetTitle: {
type: String,
default: null
},
presetOptionTitle: {
type: String,
default: null
}
const props = defineProps({
value: {
type: Boolean
},
methods: {
close() {
const vm = this;
vm.$emit("input", false);
}
form: {
type: Object,
required: true
},
computed: {
transition() {
const vm = this;
return vm.$vuetify.breakpoint.smAndDown ?
"dialog-bottom-transition" :
"dialog-transition";
}
screenshotInput: {
type: Array,
default: () => ([])
},
screenshotOutput: {
type: Array,
required: true
},
calculatorTitle: {
type: String,
required: true
},
presetTitle: {
type: String,
default: null
},
presetOptionTitle: {
type: String,
default: null
}
});
const emit = defineEmits(["input"]);
const currentTab = ref(0);
const close = () => {
emit("input", false);
};
</script>

<style lang="scss" scoped="">
@import "~vuetify/src/styles/styles.sass";
.vh-share-tabs {
background: map-get($material-dark-elevation-colors, "4")
:deep(.v-dialog) {
display: flex;
flex-flow: column nowrap;
background: map-get($material-dark-elevation-colors, "1");
.v-toolbar {
flex: 0
}
.body {
display: flex;
flex-direction: column;
height: 100%;
overflow-y: auto;
flex: 1
}
}
@media #{map-get($display-breakpoints, "sm-and-down")} {
html:has(.v-dialog.v-dialog--active) {
position: fixed;
&, body {
width: 100%;
height: 100%;
inset: 0;
overflow: hidden
}
body {
position: absolute
}
}
}
</style>

0 comments on commit 89ee81d

Please sign in to comment.