Skip to content

Commit 2c8ccee

Browse files
committed
Add fullscreen mode
1 parent 217475a commit 2c8ccee

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

dist/js/field.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"/js/field.js": "/js/field.js?id=15620b3e531fb4496884"
2+
"/js/field.js": "/js/field.js?id=e534e43a5e9b3e765e3b"
33
}

resources/js/components/FormField.vue

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
<template>
2-
<default-field :field="field" :errors="errors">
2+
<default-field :field="field" :errors="errors" :full-width-content="true">
33
<template slot="field">
4+
<button
5+
id="fullscreenToggleButton"
6+
class="text-xs bg-90 hover:bg-black text-white font-semibold rounded-sm px-4 py-1 m-1 border"
7+
@click="toggleFullscreen"
8+
type="button">
9+
▶ Enter fullscreen
10+
</button>
411
<div :id=containerId :style="{height: field.height || '800px'}"></div>
512
<p v-if="hasError" class="my-2 text-danger">
613
{{ firstError }}
@@ -28,6 +35,19 @@
2835
},
2936
3037
methods: {
38+
toggleFullscreen() {
39+
document.body.classList.toggle('overflow-hidden');
40+
const container = document.getElementById(`${this.containerId}`);
41+
container.classList.toggle('z-50');
42+
container.classList.toggle('fullscreen');
43+
44+
const toggleButton = document.querySelector(`#fullscreenToggleButton`);
45+
toggleButton.classList.toggle('stickyControl');
46+
container.classList.contains('fullscreen')
47+
? toggleButton.innerText = '✖︎ Exit fullscreen'
48+
: toggleButton.innerText = '▶ Enter fullscreen';
49+
},
50+
3151
/*
3252
* Set the initial, internal value for the field.
3353
*/
@@ -101,3 +121,20 @@
101121
},
102122
}
103123
</script>
124+
125+
<style scoped>
126+
.fullscreen {
127+
position: fixed;
128+
left: 1vw;
129+
top: 1vh;
130+
width: 98vw !important;
131+
height: 98vh !important;
132+
}
133+
134+
.stickyControl {
135+
position: fixed;
136+
left: 1vw;
137+
top: 1vh;
138+
z-index: 51;
139+
}
140+
</style>

0 commit comments

Comments
 (0)