-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMockupComponent.vue
88 lines (78 loc) · 1.77 KB
/
MockupComponent.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<script setup lang="ts">
import { ref } from "vue";
import { VPButton } from "vitepress/theme";
const showMobile = ref(false);
const toggleView = () => {
showMobile.value = !showMobile.value;
};
defineProps<{
link: string;
title: string;
hasMobileView?: false;
}>();
</script>
<template>
<div>
<VPButton
v-if="hasMobileView"
@click="toggleView"
size="medium"
tag="button"
:text="showMobile ? 'Show Desktop' : 'Show Mobile'"
theme="brand"></VPButton>
<Transition name="fade" mode="out-in">
<div v-if="!showMobile" class="laptop-mockup">
<iframe :src="link" :title="title"></iframe>
</div>
<div v-else class="mobile-mockup">
<iframe :src="link" :title="title"></iframe>
</div>
</Transition>
</div>
</template>
<style scoped>
.laptop-mockup {
position: relative;
width: 100%;
aspect-ratio: 1.6;
overflow: hidden;
border-radius: 10px;
border: black solid 10px;
display: flex;
justify-content: center;
align-content: center;
margin-top: 12px;
}
.laptop-mockup iframe {
position: absolute;
top: -50%;
left: center;
min-width: 1440px;
min-height: 900px;
transform: scale(0.58);
transform-origin: center;
border: none;
}
.mobile-mockup {
width: 375px;
aspect-ratio: 9/18;
border: 16px solid black;
border-radius: 40px;
box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.2);
margin: 0 auto;
overflow: hidden;
}
.mobile-mockup iframe {
width: 105%;
height: 100%;
border: none;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s ease;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
</style>