Skip to content

Commit 69f05e0

Browse files
dev: add resizing for iframe container
1 parent 4ff819d commit 69f05e0

File tree

1 file changed

+71
-12
lines changed

1 file changed

+71
-12
lines changed

pages/cases/design/websites/_slug.vue

Lines changed: 71 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,24 +85,58 @@
8585
v-if="!website.img.embed"
8686
:preview="website"
8787
/>
88-
<div
88+
<v-sheet
8989
v-else
90-
class="position-relative"
90+
v-resize="onResize"
91+
v-box-shadow="9"
92+
class="position-relative overflow-x-hidden iframe-container"
93+
style="
94+
height: 16rem;
95+
max-height: 100vh;
96+
overflow-y: scroll;
97+
resize: vertical;
98+
"
9199
>
92-
<iframe
93-
:src="website.img.embed"
94-
width="100%"
95-
height="450"
96-
frameborder="0"
97-
allowfullscreen
98-
/>
100+
<v-lazy
101+
height="inherit"
102+
max-height="inherit"
103+
>
104+
<iframe
105+
:src="website.img.embed"
106+
width="100%"
107+
frameborder="0"
108+
allowfullscreen
109+
style="height: calc(100% - 8px)"
110+
/>
111+
</v-lazy>
99112
<v-sheet
100113
class="position-absolute"
101-
height="48"
102114
width="calc(100% + 1px)"
115+
height="56"
103116
style="bottom: 0; background-color: var(--light)"
104-
/>
105-
</div>
117+
>
118+
<v-sheet
119+
v-if="blockSize.w === blockSize.c"
120+
width="100%"
121+
height="inherit"
122+
color="info"
123+
dark
124+
class="d-flex align-center px-4"
125+
>
126+
<v-icon left>{{ mdiAlertOutline }}</v-icon>
127+
{{ resize.max }}
128+
</v-sheet>
129+
<div
130+
v-else
131+
class="fill-height d-flex align-center px-4"
132+
>
133+
{{ resize.limit }}
134+
<v-icon size="16">
135+
{{ mdiResizeBottomRight }}
136+
</v-icon>
137+
</div>
138+
</v-sheet>
139+
</v-sheet>
106140
</v-col>
107141
<!-- /COMPONENT -->
108142

@@ -287,6 +321,8 @@
287321
</template>
288322

289323
<script>
324+
import { mdiAlertOutline, mdiResizeBottomRight } from '@mdi/js'
325+
290326
export default {
291327
name: 'CasesDesignWebsitesSlug',
292328
async asyncData({ $content, app, params }) {
@@ -312,6 +348,18 @@ export default {
312348
next,
313349
}
314350
},
351+
data: () => ({
352+
mdiAlertOutline,
353+
mdiResizeBottomRight,
354+
blockSize: {
355+
w: 0,
356+
c: 0,
357+
},
358+
resize: {
359+
max: 'Max height - 100vh.',
360+
limit: 'Click and drag down.',
361+
},
362+
}),
315363
head() {
316364
return {
317365
title: this.website?.title ? this.website.title : '',
@@ -341,6 +389,17 @@ export default {
341389
}
342390
},
343391
},
392+
mounted() {
393+
this.onResize()
394+
},
395+
methods: {
396+
onResize() {
397+
this.blockSize = {
398+
w: window.innerHeight,
399+
c: document.querySelector('.iframe-container')?.clientHeight,
400+
}
401+
},
402+
},
344403
}
345404
</script>
346405

0 commit comments

Comments
 (0)